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
One Comment
Hi Cody, I’ve been looking for a recent article or post on the 502 Error with ISPconfig, Nginx and WordPress. I just rebooted my server, before reading your post. I’ve been getting this error sometimes, and a “database cannot connect” (most often shown as Error 500 – Internal Server Error) error at other times, once or twice per day. A reboot via by SSH client is a band-aid fix. Will try your suggested fix next time (later today likely). I’m not experienced with Linux, so finding a setup that mirrors mine, in your post, is cause for hope.
My second issue with this ISPconfig 3.1.x is that I’ve never been able to get a Filezilla FTP client to connect successfully. If you have a moment, can you suggest how I might diagnose this?
Here’s output from https://testfpt.net
Test log
Status: Resolving address of *.**.com
Status: Connecting to 209.**.**.**
Warning: The entered address does not resolve to an IPv6 address.
Status: Connected, waiting for welcome message…
Reply: 220———- Welcome to Pure-FTPd [privsep] [TLS] ———-
Reply: 220-You are user number 1 of 50 allowed.
Reply: 220-Local time is now 01:23. Server port: 21.
Reply: 220-This is a private system – No anonymous login
Reply: 220-IPv6 connections are also welcome on this server.
Reply: 220 You will be disconnected after 15 minutes of inactivity.
Command: CLNT https://ftptest.net on behalf of 50.**.**.**
Reply: 530 You aren’t logged in
Command: AUTH TLS
Reply: 234 AUTH TLS OK.
Status: Performing TLS handshake…
Status: TLS handshake successful, verifying certificate…
Status: Received 1 certificates from server. *cert info deleted*
Command: USER mainadminadminAvada
Reply: 331 User mainadminadminAvada OK. Password required
Command: PASS ****************
Error: Connection timed out
Thanks.
Peter