• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

php-fpm.sock failed (13: Permission denied) while connecting to upstream

AbramS

Basic Pleskian
I recently acquired a brand-new CentOS 6.3 VPS with Plesk 11.0 pre-installed. After getting everything up and running and installing some additional PHP versions I noticed that Nginx worked but Nginx with PHP-FPM enabled caused 502 Bad Gateway errors.

Today I took the time to completely reinstall following these steps:
1. Reinstall CentOS6.3 / Plesk Image.
2. Activate Plesk panel 11.0
3. Yum Update all system and package files.
4. Update to Plesk 11.5.30 Update #8
5. Enable RoundCube through 'Add or Remove Components'
6. Check if all components are up to date through the panel
7. Check yum update once more
8. Install Remi and EPEL repo's and give them low priorities to prevent them updating all sorts of files.
9. Install PHP-FPM through 'Add or Remove Components'
10. Create new service plan
11. Create test domain inspyred.nl
12. Enable 'Serve static files directly by nginx' and 'Process PHP by nginx'
13. Create info.php (<?php phpinfo(); ?>) inside the default 'test' folder.
14. Navigate to inspyred.nl/test/info.php

The results remains the same: 502 bad gateway.

I then checked /var/log/php-fpm/error.log for errors:
Code:
[29-Jul-2013 18:24:50] NOTICE: fpm is running, pid 4682
[29-Jul-2013 18:24:50] NOTICE: ready to handle connections
Requested PHP-FPM status:
Code:
php-fpm (pid  4682) is running...
Restarted PHP-FPM:
Code:
Stopping php-fpm:                                          [  OK  ]
Starting php-fpm:                                          [  OK  ]
Requested nginx status:
Code:
nginx (pid  2570) is running...
Restarted nginx:
Code:
Starting nginx:                                            [  OK  ]
And finally checked /var/log/nginx/error.log for errors and found:
Code:
2013/07/29 18:29:04 [crit] 4592#0: *89 connect() to unix:/var/www/vhosts/system/inspyred.nl/php-fpm.sock failed (13: Permission denied) while connecting to upstream, client: xx.xx.xx.xx, server: inspyred.nl, request: "GET /test/info.php HTTP/1.1", upstream: "fastcgi://unix:/var/www/vhosts/system/inspyred.nl/php-fpm.sock:", host: "inspyred.nl"

I had already seen this in the previous installation so I have already tried adding additional group rights to nginx...

How can I fix this?
 
Thanks Nikolay that was the required change!

Do you also know of a way of keeping SELinux in 'enforcing' mode and having PHP-FPM work? Or is Plesk 11.5 safe enough without SELinux in enforce-mode?
 
If you would pull relevant records from audit.log that would help Parallels fix Plesk SELinux policy and/or generate additional rules you can apply for the time being. You can also use audit2allow utility to do that yourself.

That said it is a common recommendation to disable SELinux on servers with Plesk since there are often such kind of hiccups.
 
Okey, looks like I have managed to reproduce the issue.
Fix will be released later. (In one of the future updates for 11.5.30)
 
Last edited:
Back
Top