Website gives 503 error when VPS is restarted

SYSTEM INFORMATION
OS type and version CentOS 7
Virtualmin version 7.3
Webmin version 2.001

I have 2 sites (1 main site and another one configured as sub-server) running with PHP 7.2 (I haven’t installed any additional PHP modules or versions, so it’s a clean install). Under PHP options, I’ve selected FPM as PHP script execution mode for both of them.

The issue I am facing is that whenever I reboot my VPS, I get 503 error (Service Unavailable) when trying to access each of the sites. They only go back online after I go to Server Configuration > PHP options and click “save”, without changing anything (it doesn’t matter if I do that on the main site or on the sub-server site).

This issue doesn’t seem to have anything to do with PHP-FPM, since the service “php-fpm.service” is always in the correct state (active - running).

Could someone tell me what are all the steps that run in the script when the user clicks “save” under PHP options? Then I could at least create a cronjob at boot time (so that I do not need do login to Virtualmin everytime I need to restart the VPS) while I try to troubleshoot what exactly is going on.

Thank you in advance for any help!

@rtyuab,

What does your “error_log” say?

Hi @tpnsolutions,

Here are the last lines of file /var/log/httpd/error_log:

[Thu Dec 29 21:11:32.901444 2022] [ssl:warn] [pid 509] AH02292: Init: Name-based SSL virtual hosts only work for clients with TLS server name indication support (RFC 4366)
[Thu Dec 29 21:11:32.902978 2022] [mpm_prefork:notice] [pid 509] AH00163: Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips mod_fcgid/2.3.9 configured -- resuming normal operations
[Thu Dec 29 21:11:32.902995 2022] [core:notice] [pid 509] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND'
[Thu Dec 29 21:18:59.240599 2022] [mpm_prefork:notice] [pid 509] AH00171: Graceful restart requested, doing restart
[Thu Dec 29 21:18:59.322448 2022] [lbmethod_heartbeat:notice] [pid 509] AH02282: No slotmem from mod_heartmonitor
[Thu Dec 29 21:18:59.323316 2022] [ssl:warn] [pid 509] AH02292: Init: Name-based SSL virtual hosts only work for clients with TLS server name indication support (RFC 4366)
[Thu Dec 29 21:18:59.324848 2022] [mpm_prefork:notice] [pid 509] AH00163: Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips mod_fcgid/2.3.9 configured -- resuming normal operations
[Thu Dec 29 21:18:59.324866 2022] [core:notice] [pid 509] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND'
[Thu Dec 29 21:58:13.743235 2022] [mpm_prefork:notice] [pid 509] AH00170: caught SIGWINCH, shutting down gracefully
[Thu Dec 29 21:58:35.887876 2022] [suexec:notice] [pid 502] AH01232: suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Thu Dec 29 21:58:35.889763 2022] [ssl:warn] [pid 502] AH02292: Init: Name-based SSL virtual hosts only work for clients with TLS server name indication support (RFC 4366)
[Thu Dec 29 21:58:35.951054 2022] [lbmethod_heartbeat:notice] [pid 502] AH02282: No slotmem from mod_heartmonitor
[Thu Dec 29 21:58:35.952330 2022] [ssl:warn] [pid 502] AH02292: Init: Name-based SSL virtual hosts only work for clients with TLS server name indication support (RFC 4366)
[Thu Dec 29 21:58:35.970049 2022] [mpm_prefork:notice] [pid 502] AH00163: Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips mod_fcgid/2.3.9 configured -- resuming normal operations
[Thu Dec 29 21:58:35.970089 2022] [core:notice] [pid 502] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND'
[Thu Dec 29 21:59:40.142762 2022] [mpm_prefork:notice] [pid 502] AH00171: Graceful restart requested, doing restart
[Thu Dec 29 21:59:40.226530 2022] [lbmethod_heartbeat:notice] [pid 502] AH02282: No slotmem from mod_heartmonitor
[Thu Dec 29 21:59:40.227501 2022] [ssl:warn] [pid 502] AH02292: Init: Name-based SSL virtual hosts only work for clients with TLS server name indication support (RFC 4366)
[Thu Dec 29 21:59:40.229060 2022] [mpm_prefork:notice] [pid 502] AH00163: Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips mod_fcgid/2.3.9 configured -- resuming normal operations
[Thu Dec 29 21:59:40.229093 2022] [core:notice] [pid 502] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND'

@rtyuab,

Wrong “error_log”.

You want to send:

“/var/log/virtualmin/domain.com_error_log”

*** where “domain.com” is the domain in question ***

@tpnsolutions ,

Sorry for that!

Here are the lines created on this other error log file after I try to access the website (following a VPS restart):

[Thu Dec 29 22:41:05.203171 2022] [proxy:error] [pid 561] (2)No such file or directory: AH02454: FCGI: attempt to connect to Unix domain socket /var/php-fpm/16723367433869.sock (*) failed
[Thu Dec 29 22:41:05.203243 2022] [proxy_fcgi:error] [pid 561] [client [MY_IP_ADDRESS]:56042] AH01079: failed to make connection to backend: httpd-UDS
[Thu Dec 29 22:41:05.691220 2022] [proxy:error] [pid 560] (2)No such file or directory: AH02454: FCGI: attempt to connect to Unix domain socket /var/php-fpm/16723367433869.sock (*) failed
[Thu Dec 29 22:41:05.691291 2022] [proxy_fcgi:error] [pid 560] [client [MY_IP_ADDRESS]:56043] AH01079: failed to make connection to backend: httpd-UDS, referer: https://[MY_WEBSITE].com/

@rtyuab,

Restart “php-fpm”, then try accessing the site again.

sudo systemctl restart php-fpm.service

Even if the service appears to be “up” it looks like it’s become defunct.

@tpnsolutions ,

I had tried that before opening this topic. Restarting the php-fpm does nothing, only saving php options (without changing anything) solves the problem. So there is something else on the saving php script that does the trick, but I don’t know what.

I must also say that the status of php-fpm just after VPS reboot shows “active (running)”.

@rtyuab,

Are you running multiple versions of PHP?

If so, it might be a different version of PHP-FPM that you need to restart.

You also might want to change the connection mode from “socket” to “tcp port”. On a few of our older servers we found the “tcp port” method was a bit more stable.

System Settings > Server Templates > Default Settings > PHP Options

*** I’m not sure if this change will address existing domains, or only new ones. ***

1 Like

@tpnsolutions ,

The issue was simply this: both services related to FPM (php-fpm.service and rh-php72-php-fpm.service) were not enabled by default on systemd. So I have simply enabled them and now I can reboot the VPS without any problems.

So this seems something to be fixed on the PHP options script… Shouldn’t it enable PHP-FPM services as soon as the user saves the changes when choosing FPM as the default PHP script execution method?

Thank you once again for your support, which helped me find the solution!

This topic was automatically closed 8 days after the last reply. New replies are no longer allowed.