502 Bad Gateway when I try to access webgui with domain after I turned on ssl and force ssl option

    • OMV 4.x
    • Resolved

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • 502 Bad Gateway when I try to access webgui with domain after I turned on ssl and force ssl option

      Hello

      In OMV 4, after I turned on ssl and force ssl option on webgui, I got 502 Bad Gateway when I access to webgui with domain.(It's okay when I access webgui with ip address)

      How can I solve this problem?

      Source Code

      1. server {
      2. server_name openmediavault-webgui;
      3. root /var/www/openmediavault;
      4. index index.php;
      5. autoindex off;
      6. server_tokens off;
      7. sendfile on;
      8. large_client_header_buffers 4 32k;
      9. client_max_body_size 25M;
      10. error_log /var/log/nginx/openmediavault-webgui_error.log error;
      11. access_log /var/log/nginx/openmediavault-webgui_access.log combined;
      12. error_page 404 = /404.php;
      13. location /404.html {
      14. internal;
      15. }
      16. location /extjs6/ {
      17. alias /usr/share/javascript/extjs6/;
      18. expires 2d;
      19. }
      20. location ~ ^/(css|fonts|js|images)/ {
      21. expires 2d;
      22. }
      23. location /favicon {
      24. expires 14d;
      25. }
      26. location ~ \.php$ {
      27. try_files $uri =;
      28. fastcgi_split_path_info ^(.+\.php)(/.+)$;
      29. fastcgi_pass unix:/var/run/php-fpm-openmediavault-webgui.sock;
      30. fastcgi_index index.php;
      31. fastcgi_read_timeout 60s;
      32. include fastcgi.conf;
      33. fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
      34. }
      35. listen 8080;
      36. if ($scheme = http) {
      37. # Force redirection to HTTPS.
      38. return 301 https://$host:443$request_uri;
      39. }
      40. listen 443 ssl deferred;
      41. ssl_certificate /etc/ssl/certs/openmediavault-5daf540b-ae9b-4474-a65f-eb73712c1f12.crt;
      42. ssl_certificate_key /etc/ssl/private/openmediavault-5daf540b-ae9b-4474-a65f-eb73712c1f12.key;
      43. include /etc/nginx/openmediavault-webgui.d/*.conf;
      44. }
      Display All


      Source Code: /etc/php/7.0/fpm/pool.d/openmediavault-webgui.conf

      1. [openmediavault-webgui]
      2. user = openmediavault-webgui
      3. group = openmediavault-webgui
      4. listen = /var/run/php-fpm-openmediavault-webgui.sock
      5. listen.owner = www-data
      6. listen.group = www-data
      7. listen.mode = 0600
      8. pm = ondemand
      9. pm.max_children = 25
      10. pm.process_idle_timeout = 10s
      11. chdir = /
      12. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
      13. ; openmediavault php.ini settings ;
      14. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
      15. ; Paths and Directories
      16. php_value[include_path] = ".:/usr/share/php:/var/www/openmediavault"
      17. ; Pam Authentication Support (see /etc/pam.d)
      18. php_value[pam.servicename] = "openmediavault-webgui";
      19. ; Maximum allowed size for uploaded files.
      20. ; http://php.net/upload-max-filesize
      21. php_value[upload_max_filesize] = 25M
      22. ; Maximum size of POST data that PHP will accept.
      23. ; http://php.net/post-max-size
      24. php_value[post_max_size] = 25M
      25. ; Do not expose to the world that PHP is installed on the server.
      26. ; http://php.net/expose-php
      27. php_value[expose_php] = Off
      28. ; Name of the session (used as cookie name).
      29. ; http://php.net/session.name
      30. php_value[session.name] = X-OPENMEDIAVAULT-SESSIONID
      31. ; Default timeout for socket based streams (seconds)
      32. ; http://php.net/default-socket-timeout
      33. php_value[default_socket_timeout] = 90
      34. ; Maximum execution time of each script, in seconds
      35. ; http://php.net/max-execution-time
      36. ; Note: This directive is hardcoded to 0 for the CLI SAPI
      37. php_value[max_execution_time] = 90
      Display All

      Source Code: /var/log/nginx/openmediavault-webgui_error.log

      1. ......
      2. 2018/02/12 09:28:21 [error] 17040#17040: *45 FastCGI sent in stderr: "PHP message: PHP Warning: DOMDocument::load(/etc/openmediavault/config.xml): failed to open stream: Permission denied in /usr/share/php/openmediavault/config/databasebackend.inc on line 114" while reading response header from upstream, client: 127.0.0.1, server: openmediavault-webgui, request: "HEAD / HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "127.0.0.1"
    • The file /etc/openmediavault/config.xml has not the correct privileges.

      Shell-Script

      1. chmod 660 /etc/openmediavault/config.xml
      2. chown :openmediavault-config /etc/openmediavault/config.xml
      Absolutely no support through PM!

      I must not fear.
      Fear is the mind-killer.
      Fear is the little-death that brings total obliteration.
      I will face my fear.
      I will permit it to pass over me and through me.
      And when it has gone past I will turn the inner eye to see its path.
      Where the fear has gone there will be nothing.
      Only I will remain.

      Litany against fear by Bene Gesserit
    • having same "502: Bad Gateway" problem. Fresh install of 3.0.9.4 .
      ran the following commands:

      root@openmediavault:~# systemctl status php5-fpm.service

      Source Code

      1. root@openmediavault:~# systemctl status php5-fpm.service
      2. â php5-fpm.service - The PHP FastCGI Process Manager
      3. Loaded: loaded (/lib/systemd/system/php5-fpm.service; enabled)
      4. Active: failed (Result: exit-code) since Mon 2018-03-05 23:31:52 CST; 47s ago
      5. Process: 3399 ExecStart=/usr/sbin/php5-fpm --nodaemonize --fpm-config /etc/php5/fpm/php-fpm.conf (code=exited, status=78)
      6. Process: 3393 ExecStartPre=/usr/lib/php5/php5-fpm-checkconf (code=exited, status=0/SUCCESS)
      7. Main PID: 3399 (code=exited, status=78)
      8. Mar 05 23:31:52 openmediavault systemd[1]: Starting The PHP FastCGI Process Manager...
      9. Mar 05 23:31:52 openmediavault php5-fpm[3399]: [05-Mar-2018 23:31:52] ERROR: [pool openmediavault-webgui] cannot get uid for user 'openmediavault-webgui'
      10. Mar 05 23:31:52 openmediavault php5-fpm[3399]: [05-Mar-2018 23:31:52] ERROR: FPM initialization failed
      11. Mar 05 23:31:52 openmediavault systemd[1]: php5-fpm.service: main process exited, code=exited, status=78/n/a
      12. Mar 05 23:31:52 openmediavault systemd[1]: Failed to start The PHP FastCGI Process Manager.
      13. Mar 05 23:31:52 openmediavault systemd[1]: Unit php5-fpm.service entered failed state.
      Display All
      root@openmediavault:~# systemctl status nginx.service

      Source Code

      1. root@openmediavault:~# systemctl status nginx.service â nginx.service - A high performance web server and a reverse proxy server
      2. Loaded: loaded (/lib/systemd/system/nginx.service; enabled)
      3. Active: failed (Result: exit-code) since Mon 2018-03-05 23:29:58 CST; 8min ago
      4. Process: 2152 ExecStop=/sbin/start-stop-daemon --quiet --stop --retry QUIT/5 --pidfile /run/nginx.pid (code=exited, status=1/FAILURE)
      5. Process: 3210 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=1/FAILURE)
      6. Process: 3207 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
      7. Main PID: 1278 (code=exited, status=0/SUCCESS)
      8. Mar 05 23:29:56 openmediavault nginx[3210]: nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
      9. Mar 05 23:29:56 openmediavault nginx[3210]: nginx: [emerg] bind() to [::]:443 failed (98: Address already in use)
      10. Mar 05 23:29:57 openmediavault nginx[3210]: nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
      11. Mar 05 23:29:57 openmediavault nginx[3210]: nginx: [emerg] bind() to [::]:443 failed (98: Address already in use)
      12. Mar 05 23:29:57 openmediavault nginx[3210]: nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
      13. Mar 05 23:29:57 openmediavault nginx[3210]: nginx: [emerg] bind() to [::]:443 failed (98: Address already in use)
      14. Mar 05 23:29:58 openmediavault nginx[3210]: nginx: [emerg] still could not bind()
      15. Mar 05 23:29:58 openmediavault systemd[1]: nginx.service: control process exited, code=exited status=1
      16. Mar 05 23:29:58 openmediavault systemd[1]: Failed to start A high performance web server and a reverse proxy server.
      17. Mar 05 23:29:58 openmediavault systemd[1]: Unit nginx.service entered failed state.
      Display All
      This fresh install was the end result as i was attempting to fix a stoneburner install that had a full OS drive and was showing this error. Should i just jump to 4? seems OMV may be having a problem with php5-fpm. Any suggestions appreciated.
      OMV1: OMV 2.2.1 - Intel Xeon "E5530" @ 2.4 GHz - 48 GB DDR3 ECC 800 - 18.19 TB Software Raid 5

      Desktop:
      Win 10 Pro - AMD A10-5800 APU @ 3.8 GHz - 16 GB DDR 3 1866 - 600 GB
    • ok, i downloaded 4.0.14 and installed . . . when it boots, the CLI shows as 3.0.97. should it be that way? but the 502 error still persists when i try to access WebGUI
      OMV1: OMV 2.2.1 - Intel Xeon "E5530" @ 2.4 GHz - 48 GB DDR3 ECC 800 - 18.19 TB Software Raid 5

      Desktop:
      Win 10 Pro - AMD A10-5800 APU @ 3.8 GHz - 16 GB DDR 3 1866 - 600 GB
    • Source Code

      1. root@openmediavault:~# systemctl -l status nginx.service
      2. â nginx.service - A high performance web server and a reverse proxy server
      3. Loaded: loaded (/lib/systemd/system/nginx.service; enabled)
      4. Active: inactive (dead) since Tue 2018-03-06 00:16:14 CST; 8h ago
      5. Process: 2105 ExecStop=/sbin/start-stop-daemon --quiet --stop --retry QUIT/5 --pidfile /run/nginx.pid (code=exited, status=1/FAILURE)
      6. Process: 1226 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
      7. Process: 1089 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
      8. Main PID: 1227 (code=exited, status=0/SUCCESS)
      9. Mar 06 00:15:14 openmediavault systemd[1]: Started A high performance web server and a reverse proxy server.

      Source Code

      1. root@openmediavault:~# systemctl -l status php5-fpm.service
      2. â php5-fpm.service - The PHP FastCGI Process Manager
      3. Loaded: loaded (/lib/systemd/system/php5-fpm.service; enabled)
      4. Active: failed (Result: exit-code) since Tue 2018-03-06 00:15:25 CST; 8h ago
      5. Process: 1282 ExecStart=/usr/sbin/php5-fpm --nodaemonize --fpm-config /etc/php5/fpm/php-fpm.conf (code=exited, status=78)
      6. Process: 1079 ExecStartPre=/usr/lib/php5/php5-fpm-checkconf (code=exited, status=0/SUCCESS)
      7. Main PID: 1282 (code=exited, status=78)
      8. Mar 06 00:15:25 openmediavault php5-fpm[1282]: [06-Mar-2018 00:15:25] ERROR: [pool openmediavault-webgui] cannot get uid for user 'openmediavault-webgui'
      9. Mar 06 00:15:25 openmediavault php5-fpm[1282]: [06-Mar-2018 00:15:25] ERROR: FPM initialization failed
      10. Mar 06 00:15:25 openmediavault systemd[1]: php5-fpm.service: main process exited, code=exited, status=78/n/a
      11. Mar 06 00:15:25 openmediavault systemd[1]: Failed to start The PHP FastCGI Process Manager.
      12. Mar 06 00:15:25 openmediavault systemd[1]: Unit php5-fpm.service entered failed state.
      Display All
      [cat /var/log/nginx/openmediavault-webgui_error.log] produces several lines of the following


      Source Code

      1. 2018/03/06 08:59:45 [crit] 25437#0: *1 connect() to unix:/var/run/php5-fpm-openmediavault-webgui.sock failed (2: No such file or directory) while connecting to upstream, client: ::ffff:127.0.0.1, server: openmediavault-webgui, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm-openmediavault-webgui.sock:", host: "127.0.0.1:443"
      OMV1: OMV 2.2.1 - Intel Xeon "E5530" @ 2.4 GHz - 48 GB DDR3 ECC 800 - 18.19 TB Software Raid 5

      Desktop:
      Win 10 Pro - AMD A10-5800 APU @ 3.8 GHz - 16 GB DDR 3 1866 - 600 GB
    • Users Online 1

      1 Guest