Symptoms
-
Domain example.com does not work, with the following errors displayed while opening it in a browser:
503 service unavailable
502 Bad Gateway
Nginx -
Errors that are similar to the following appear in the domain's Apache error log
/var/www/vhosts/system/example.com/logs/error_log
:CONFIG_TEXT: [proxy:error] [pid 15065:tid 139826443527936] (111)Connection refused: AH02454: FCGI: attempt to connect to Unix domain socket /data/vhosts/system/example.com/php-fpm.sock (*) failed
[proxy_fcgi:error] [pid 15065:tid 139826443527936] [client 203.0.113.2:50232] AH01079: failed to make connection to backend: httpd-UDS - Errors that are similar to the following appear in the domain's nginx error log:
2024/02/12 10:31:43 [error] 26259#0: *595 connect() to unix:/var/www/vhosts/system/example.com/php-fpm.sock failed (111: Connection refused) while connecting to upstream, client: 2001:db8:f61:a1ff:0:0:0:80, server: example.com, request: "GET / HTTP/2.0", upstream: "fastcgi://unix:/var/www/vhosts/system/example.com/php-fpm.sock:", host: "example.com"
2024/02/12 10:31:44 [error] 26259#0: *595 connect() to unix:/var/www/vhosts/system/example.com/php-fpm.sock failed (111: Connection refused) while connecting to upstream, client: 2001:db8:f61:a1ff:0:0:0:80, server: example.com, request: "GET / HTTP/2.0", upstream: "fastcgi://unix:/var/www/vhosts/system/example.com/php-fpm.sock:", host: "example.com"
2024/02/12 10:31:45 [error] 26259#0: *595 connect() to unix:/var/www/vhosts/system/example.com/php-fpm.sock failed (111: Connection refused) while connecting to upstream, client: 2001:db8:f61:a1ff:0:0:0:80, server: example.com, request: "GET / HTTP/2.0", upstream: "fastcgi://unix:/var/www/vhosts/system/example.com/php-fpm.sock:", host: "example.com"
Cause
Configuration file for the affected domain are missing in /opt/plesk/php/X.X/etc/php-fpm.d/
directory.
Resolution
Regenerate the configuration by executing the following steps:
Click on a section to expand
For a single domain
- Log into Plesk.
- Go to Domains > example.com > PHP Settings and change PHP handler to different one and click OK
- Change PHP handler version back and click OK.
For multiple domains
-
Connect to the server via SSH;
Note: if direct SSH access to the server is not possible, contact server administrator for further assistance.
-
Execute the following command to update settings on all domains:
# /usr/local/psa/bin/php_settings -u
- Execute the command to get a list of all installed PHP handlers:
# plesk bin php_handler --list | grep -E plesk.*fpm | awk -F" " '{ print $1 }'
plesk-php71-fpm
plesk-php72-fpm
plesk-php73-fpm
plesk-php74-fpm -
Restart PHP handler processes for the used PHP versions, for example:
# systemctl restart plesk-php74-fpm
Additional information
PHP Management | Plesk Obsidian documentation