502 Bad Gateway on Wordpress


I’m new to VPS and am trying to learn from mistakes. I’m got 502 Bad Gateway from contraargumento.com.br.

This is my conf file from /etc/nginx/sites-available/contraargumento.com.br : http://pastebin.com/N1gq3XHy

nginx.conf: http://pastebin.com/yNyUYg9Q

What is causing 502? I got the nginx-cache-purge in the output command and php-fm. The others sites in the VPS are fine, like http://teste.iagomacedo.com.br/

Thanks for all the help and tutorials!


And this is my error log: http://pastebin.com/uSUxmACG

What’s crystal clear to me is php-fpm is not running (that’s what causes Nginx to raise a 502 error). You should take a look at /var/log/php5/fpm.log. Depending on what you find there, you could think of the actual issue.

Thanks for the answer :slight_smile:

I did sudo service php5-fpm start and return this: start: Job is already running: php5-fpm

About my log, i found in /var/log/php5-fpm.log:

NOTICE: configuration file /etc/php5/fpm/php-fpm.conf test is successful

Which port is php-fpm listening on?

Why don’t you use EaseyEngine to setup your vhosts? :slight_smile:


analyse your site access and error logs for 502 bad gateway. you will surely get way to rid off.

I was trying to learn step by step

So, i removed the 502 error uncomment

listen.owner = www-data
listen.group = www-data
listen.mode = 0660

In /etc/php5/fpm/pool.d/www.conf