Nginx 502 Bad Gateway after PHP version upgrade.

After installing a PHP version upgrade upgrade I was greeted with an HTTP 502 error for my WordPress site, running on NGINX. Investigating the log files pointed to a version mis-configuration in my site config file.

Your config may vary, but it will have a line that looks something like this:

fastcgi_pass unix:/var/run/php5-fpm.sock;

That just needs to point to the new path, which by default should be /var/run/php, not just /var/run, and the updated php version:

fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;

Make sure NGINX knows to include your fastcgi configuration file by adding the path to the site location directive:

include fastcgi.conf;

Once you've updated your configuration, restart your NGINX service, and things should be fine.

Show Comments
.post-template p { text-align: justify; }