502 bad gateway nginx 1.2.1


I am facing an error 502 when trying to access erpnext.
the nginx error log says:

2015/02/04 18:14:03 [error] 5457#0: *13 connect() failed (111: Connection refused) while connecting to upstream, client:, server: frappe_default_site, request: "GET / HTTP/1.1", upstream: "", host: ""

I am running on a Virtualbox VM

Anyone know how to fix this?


1 Like

Your gunicorn is not running.

login as root and run following

supervisorctl start all

Hello and thank you for your reply but unfortunately, it does not change my problem. I get the same error in log file…

run this as root

pkill python
supervisorctl start all

Post the output of

supervisorctl tail frappe:frappe-web

Here is what I get

frappe:frappe-web: ERROR (no such process name)

Your supervisor conf is not in place. If you are running on dev setup then bench start
should do for you. Run this and access erpnext.

If you are running production setup then follow steps as root.

bench supervisor
mkdir -p /etc/supervisor/
ln -s $(pwd)/config/supervisor.conf /etc/supervisor/supervisord.conf
pkill python
supervisorctl start all

and paste output of

supervisorctl tail frappe:frappe-web

Following command will give the state of running frappe processes,

supervisorctl status

Ok, it looks like supervisor is not working correctly. When I bench start it works but not with supervisor.

Here is what I get:

root@vm-server:/# bench supervisor
Usage: bench [OPTIONS] COMMAND [ARGS]...

Error: No such command "supervisor".

root@vm-server:/# mkdir -p /etc/supervisor/

root@vm-server:/# ln -s $(pwd)/config/supervisor.conf /etc/supervisor/supervisord.conf
ln: failed to create symbolic link `/etc/supervisor/supervisord.conf': File exists

root@vm-server:/# pkill python
root@vm-server:/# supervisorctl start all

root@vm-server:/# supervisorctl tail frappe:frappe-web
frappe:frappe-web: ERROR (no such process name)

root@vm-server:/# supervisorctl status

Just run,

bench setup production

Might fail in putting nginx config, but would setup supervisor. Anyways, post the output.

Yes, it worked !

Thank you both of you for your help !

Hi i am facing a same problem 502 bad gateway nginx 1.4.6/ubuntu… please give me solution i have a data in my server