Fix “502 Bad Gateway” error on NGINX with PHP, ISPConfig, and WordPress

The Error

I recently added a new site through ISPConfig and I was receiving 502 Bad Gateway errors when trying to access a WordPress install I was trying to set up.

Diagnosis

This error is due to the PHP endpoint not existing when the server tries to access it.

I noticed that the web .sock in /var/lib/php5-fpm was missing for the new site.
As well as the process missing when running: ps aux | grep php

Troubleshooting

Running any of the following recommended commands did not help

  • service php5-fpm stop
  • service php5-fpm start
  • service php5-fpm restart
  • service nginx restart

It threw back the following message to me: stop: Unknown instance:

The Fix

What ended up working for me was to run: sudo pkill php5-fpm; sudo service php5-fpm start

Resources

Here are the sites and articles I came across that helped

  • http://jvdc.me/fix-502-bad-gateway-error-on-nginx-server-after-upgrading-php/#comment-3754
  • http://serverfault.com/questions/189940/how-do-you-restart-php-fpm

 

This entry was posted in Web Development and tagged , , , , , . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

One Comment