1

Earlier today, I updated packages on one of my servers. One of those packages was an update to php5-fpm, which seems to have broken my ability to utilize unix:/var/run/php5-fpm.sock.

Disclaimer: I only recently started using Linux; I don't fully understand what's going on here.

I've reviewed lots of other questions but have no been able to find answer to my issue, which is that I get a 502 Bad Gateway error if I try to use php5-fpm.sock instead of passing to 127.0.0.1:9000.

Here are some details that seem relevant based off of other questions:

  • My php5-fpm process is running.
  • My /etc/php5/fpm/pool.d/www.conf file has listen = /var/run/php5-fpm.sock
  • My server block has fastcgi_pass = unix:/var/run/php5-fpm.sock
  • php5-fpm.sock does exist in /var/run/.

When upgrading php5-fpm, it asked me if I wanted to overwrite my www.conf. I checked the diff and the only change between the maintainer's file and mine was that the maintainer's had listen = 127.0.0.1:9000 set as the default.

After selecting to overwrite it and finishing upgrading php5-fpm, I opened up /etc/php5/fpm/pool.d/www.conf and changed listen to listen = /var/run/php5-fpm.sock, like it had been set beforehand. I then restarted php5-fpm, and then nginx, in that order.

I now get a 502 when visiting the domain and am at a complete loss. If I change listen in www.conf and fastcgi_pass in my host file to 127.0.0.1:9000, everything works perfectly. I'm using Ubuntu 12.04LTS, if that matters.

Your help is greatly appreciated.

1 Answers1

1

You should look at the owner of the php5-fpm.sock file by using ls -l /var/run/php5-fpm.sock

I believe you'll find it set to root and your web server runs as www-data. Further, the permissions in the www.conf are 0660 which means only root will have permissions.

You can uncomment the lines related to the sock user and set it to www-data and restart the php5-fpm service

bcj
  • 71
  • 1
  • You were right, thanks for your insight. I uncommented `listen.group`, `listen.user`, and `listen.mode`. That fixed it, and I'm now able to pass `fastcgi_pass` to `unix:/var/run/php5-fpm.sock`. What is the different between this user/group and the `user` and `group` variables earlier in `www.conf`? I would think the "Unix user/group of processes" (as they are labeled) would be a logical choice for php5-fpm to use to create the socket. –  Jun 27 '14 at 23:27
  • According to [this](http://www.rackspace.com/knowledge_center/article/installing-nginx-and-php-fpm-setup-for-php-fpm) the unix user and group are the owners of the site files and not the owner or the process file. Hope this helps! – bcj Jun 27 '14 at 23:51