cannot connect to web interface after reboot: nginx Connection failed

  • Hi,


    I restarted my OMV5 system running on a Raspberry Pi4. I have done that before and never experienced any problems.


    After restart, I cannot connect to the web interface of OMV. I can connect to the web interface of Portainer and also the web interfaces of the containers.


    I received the following email:

    Code
    The system monitoring needs your attention.
    Host: \omv
    Date: Sun, 29 Mar 2020 12:54:32
    Service: nginx
    Event: Connection failed
    Description: failed protocol test [HTTP] at [127.0.0.1]:80 [TCP/IP] -- HTTP error: Server returned status 502
    This triggered the monitoring system to: restart
    You have received this notification because you have enabled the system monitoring on this host.
    To change your notification preferences, please go to the 'System | Notification' or 'System | Monitoring' page in the web interface.


    What can I do?


    Best, Markus

  • I read this post: Nginx Connection failed


    I connected with ssh to the server:


    If I understand the post correctly, shall I rename S01monit to, say S02monit?


    best, Markus

  • Thank you. What does the command do?


    I also took a look at /var/log/nginx/openmediavault-webgui_error.log (see attachement).


    There are quite a few No such file or directory messages.


    Not sure what I did wrong. I simply shutdown OMV from the web interface and then started again.


    Best, Markus

  • thanks.


    I ran

    Code
    sudo omv-salt stage run deploy

    and rebooted. The same picture: "502 Bad Gateway" for the web interface of OMV. The web interfaces of portainer etc. are working.


    Markus

  • sorry, I had to significantly increase the number of lines in order to scrollback in Putty to spot errors.


    After...

    Code
    sudo omv-salt stage run deploy

    ... there are the following lines in red:

    Code
    ----------
    ID: run_state_deploy
    Function: salt.state
    Result: False
    Comment: Run failed on minions: raspberrypi
    Started: 14:26:55.561058
    Duration: 77387.282 ms
    Changes:
    raspberrypi:

    then there are many lines in green an then...

    and finally :



    Best, Markus

  • I think it the problem is the php7.3 process:

    Code
    pi@omv:~ $ sudo systemctl restart php7.3-fpm
    Job for php7.3-fpm.service failed because the control process exited with error code.
    See "systemctl status php7.3-fpm.service" and "journalctl -xe" for details.


    Code
    pi@omv:~ $ systemctl status php7.3-fpm.service
    ● php7.3-fpm.service - The PHP 7.3 FastCGI Process Manager
    Loaded: loaded (/lib/systemd/system/php7.3-fpm.service; enabled; vendor preset: enabled)
    Active: failed (Result: exit-code) since Sun 2020-03-29 14:44:02 CEST; 503ms ago
    Docs: man:php-fpm7.3(8)
    Process: 18477 ExecStart=/usr/sbin/php-fpm7.3 --nodaemonize --fpm-config /etc/php/7.3/fpm/php-fpm.conf (code=exited, status=78)
    Main PID: 18477 (code=exited, status=78)



    Is there anything I can do?


    Best, Markus

  • I tried

    Code
    sudo omv-salt deploy run phpfpm
    sudo omv-salt deploy run nginx


    nginx executed without any failures. Please find below the output for phpfm. The entire output is "green" until...

    Code
    ID: restart_phpfpm_service


    I don't understand what's going on. Here the entire output:

  • Thanks. I've done the following:

    Code
    pi@omv:/var/lib/php/sessions $ sudo cp -rf /var/lib/php/sessions /var/lib/php/sessions.old
    pi@omv:/var/lib/php/sessions $ sudo rm -rf /var/lib/php/sessions
    pi@omv:/var/lib/php/sessions $ sudo mkdir -m 777 /var/lib/php/sessions
    pi@omv:/var/lib/php/sessions $ ls /var/lib/php -l
    total 12
    drwxr-xr-x 3 root root 4096 Feb 27 20:12 modules
    drwxrwxrwx 2 root root 4096 Mar 29 16:15 sessions
    drwx--x--t 2 root root 4096 Mar 29 16:15 sessions.old
    pi@omv:/var/lib/php/sessions $ sudo nginx -s reload
    pi@omv:/var/lib/php/sessions $

    I did not reboot.


    Same picture.


    I'm seeing...

    Code
    /run/php/php7.3-fpm-openmediavault-webgui.sock': No such file or directory (2)

    ... in openmediavault-webgui_error.log but also here:

    Is this a hint?


    Best, Markus

  • I'm reading through this trouble shouting guide: NGINX 502 Bad Gateway: PHP-FPM


    As described earlier, I took a look at nginx' error log, as suggested in the guide:

    I also took a look at /var/log/nginx/openmediavault-webgui_error.log (see attachement).

    I see a similar error message as in the guide int he section "NGINX can’t access the socket".


    The example is:

    Code
    connect() to unix:/run/php/mypool.sock failed (2: No such file or directory)

    on my system it is:

    Code
    2020/03/29 12:03:32 [crit] 877#877: *1 connect() to unix:/run/php/php7.3-fpm-openmediavault-webgui.sock failed (2: No such file or directory) while connecting to upstream, client: ::ffff:192.168.1.25, server: openmediavault-webgui, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/run/php/php7.3-fpm-openmediavault-webgui.sock:", host: "192.168.1.37"


    I checked the version of php-fm (on my system, php7.3-fpm is enabled):

    Code
    pi@omv:~ $ sudo systemctl list-unit-files | grep -E 'php[^fpm]*fpm'
    php7.3-fpm.service enabled

    and checked whether it is active or not (it is failed):

    Code
    pi@omv:~ $ sudo systemctl is-active php7.3-fpm.service
    failed


    Since php7.3-fpm is enabled on my system, I checked the relevant config file of the socket:

    Code
    nano /etc/php/7.3/fpm/pool.d/openmediavault-webgui.conf


    The listen socket in the config is /run/php/php7.3-fpm-openmediavault-webgui.sock:


    The guide then states: "Check your nginx.conf file to ensure that the relevant location block specifies the same socket."


    I checked the nginx.conf...

    Code
    nano /etc/nginx/nginx.conf

    .... but cannot see the relevant location "/run/php/php7.3-fpm-openmediavault-webgui.sock" anywhere in the config file of nginx:


    The example in the guide looks like this ("/run/php/mypool.sock" is the location of the socket in the example):

    Code
    location / { include snippets/fastcgi-php.conf;
    fastcgi_pass unix:/run/php/mypool.sock;
    }


    On my install, I can see "snippets/fastcgi-php.conf" but is not mentioned anywhere in the config.


    Is the solution to add location to nginx' config file?


    Best, Markus

  • This looks like the solution to my problem. One of the the files in the sites-enabled directory is...

    Code
    sudo nano /etc/nginx/sites-enabled/openmediavault-webgui

    and in the file the location to the socket is defined:



    Can you share your complete config with me?


    Thanks, M

  • damn... I just checked. I did not post the complete config. The complete file looks like this:

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!