502 bad gateway nginx 1.2.1

Hello,

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: 10.0.2.2, server: frappe_default_site, request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:8000/", host: "192.168.1.5"

I am running on a Virtualbox VM

Anyone know how to fix this?

Thanks!

2 Likes

Your gunicorn is not running.

login as root and run following

supervisorctl start all
2 Likes

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
root@vm-server:/#

Just run,

bench setup production

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

1 Like

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