"Bad gateway" with nginx, PHP-FPM using FreeBSD socket
📅 Aug 30, 2014
⌛ 1 minute
After updating a FreeBSD jail I got the dreaded "502 Bad gateway" error from nginx, here's how I fixed it:
Apparently there is a bug in the PHP version shipped with FreeBSD; ServerFault user MafiaInc kindly provided the solution:
Edit the file /usr/local/etc/php-fpm.conf
Note the values of the user/group lines, e.g.:
user = www group = www
Add these lines with the same values as the user/group lines:
listen.owner = www listen.group = www
Restart PHP-FPM using this command:
service php-fpm restart