Author Topic: NGINX php-fpm 502 and no sockets created  (Read 1671 times)

0 Members and 1 Guest are viewing this topic.

Offline
*
NGINX php-fpm 502 and no sockets created
« on: November 30, 2022, 04:40:03 AM »
Hi there,

I am having a heck of a time trying to get php-fpm to work to load wordpress sites. I'm using Centos 7 with pro CWP.

The wordpress sites work with Apache but when I change default webserver template to "php fpm" the sites give a 502 error.

The error log shows this

Code: [Select]
2022/11/29 23:21:31 [crit] 6613#6613: *435 connect() to unix:/opt/alt/php-fpm81/usr/var/sockets/bobbers.sock failed (2: No such file or directory) while connecting to upstream, client: 2604:3d09:138a:2a00:d1ba:98b4:3a:5a7b, server: website.com, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/opt/alt/php-fpm81/usr/var/sockets/bobbers.sock:", host: "website.com", referrer: "https://server.mainsite.com:2083/"
When I goto the folder to check "/opt/alt/php-fpm81/usr/var/sockets/" the only socket is cwpsvc.sock

The folders are 755 and file 640 with root / root permissions.

I have tried, changing versions, rebuilding server, creating new user (to see if sockets would be made), and disabling mod security and csf temporality.

I would like to get nginx to work, any help is appreciated.

Offline
*
Re: NGINX php-fpm 502 and no sockets created
« Reply #1 on: December 02, 2022, 01:19:03 AM »
Thought I would post this. Not exactly sure how it got fixed but here's what I did.

1. Reinstalled PHP/FPM and left it on that screen until finished

2. In main webserver config I noticed "Nginx default vhost template:" was set to default so I set it to wordpress SSL and rebuilt vhost

restart servers and wouldnt you know it the sockets for the users were made.

Now I image it was reinstalling the php but Im not sure.

Offline
*
Re: NGINX php-fpm 502 and no sockets created
« Reply #2 on: January 05, 2023, 01:25:16 PM »
Check out if the USERNAME folder (websites) has write permission (755), otherwise le sock files wouldn'be be created

Offline
*****
Re: NGINX php-fpm 502 and no sockets created
« Reply #3 on: January 08, 2023, 06:44:17 AM »
This doesn't sound nginx related -- I've encountered this with php-fpm and enabling new versions of PHP. The users directory is not created automatically for that new version after building it and will create an error of the .sock file missing. So you have to copy over your older users directory. For example, after enabling php 8.1, I had to create:
/opt/alt/php-fpm81/usr/etc/php-fpm.d/users
this way:
Code: [Select]
sudo cp -r /opt/alt/php-fpm74/usr/etc/php-fpm.d/users /opt/alt/php-fpm81/usr/etc/php-fpm.d/usersand then edit the new conf files to reflect the new version:
Code: [Select]
sudo perl -pi.back -e 's/php-fpm74/php-fpm81/g;' /opt/alt/php-fpm81/usr/etc/php-fpm.d/users/*.confThen restart the php-fpm process:
Code: [Select]
sudo service php-fpm81 restart