I’m trying to run a django website on a server through nginx and gunicorn. I followed these instructions to get setup but I’m receiving a bad gateway error when I google my ip. If anyone can help thanks so much! Best, Evvan
Also when I do status of nginx and gunicorn I get:
derians@myCodingBlog:~$ sudo systemctl status nginx
[sudo] password for derians:
nginx.service - A high performance web server and a reverse proxy server
Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
Active: active (running) since Tue 2017-01-03 23:50:52 UTC; 15h ago
Main PID: 28998 (nginx)
Tasks: 2
Memory: 2.1M
CPU: 163ms
CGroup: /system.slice/nginx.service |-28998 nginx: master process /usr/sbin/nginx -g daemon on; master_process on
`-28999 nginx: worker process
Jan 03 23:50:52 myCodingBlog systemd[1]: Stopped A high performance web server and a reverse proxy server.
Jan 03 23:50:52 myCodingBlog systemd[1]: nginx.service: Unit entered failed state.
Jan 03 23:50:52 myCodingBlog systemd[1]: nginx.service: Failed with result ‘timeout’.
Jan 03 23:50:52 myCodingBlog systemd[1]: Starting A high performance web server and a reverse proxy server…
Jan 03 23:50:52 myCodingBlog systemd[1]: nginx.service: Failed to read PID from file /run/nginx.pid: Invalid argument
Jan 03 23:50:52 myCodingBlog systemd[1]: Started A high performance web server and a reverse proxy server.
derians@myCodingBlog:~$ sudo systemctl status gunicorn
gunicorn.service - gunicorn daemon
Loaded: loaded (/etc/systemd/system/gunicorn.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Wed 2017-01-04 00:50:22 UTC; 14h ago
Main PID: 29271 (code=exited, status=203/EXEC) Jan 04 00:50:22 myCodingBlog systemd[1]: Started gunicorn daemon.
Jan 04 00:50:22 myCodingBlog systemd[1]: gunicorn.service: Main process exited, code=exited, status=203/EXEC
Jan 04 00:50:22 myCodingBlog systemd[1]: gunicorn.service: Unit entered failed state.
Jan 04 00:50:22 myCodingBlog systemd[1]: gunicorn.service: Failed with result ‘exit-code’.
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
I have the same problems, here is my vps description 8 core processor 16GB RAM 160 GB SSD 6TB Tranfers
i am using, uwsgi(2.0.14), nginx(1.10), mysql(5.6 )and ubuntu 16.04 LTS django 1.10.x and python 2.7.x
but the different is my deploy i using is uwsgi and mysql a share my config
---- uwsgi script in /etc/uwsgi/app-availabre/website.ini ----- http://pastebin.com/vQW47WGb
---- nginx conf in /etc/nginx/nginx.conf ------ http://pastebin.com/5BsWWaps
----- nginx vhost for my website mydomain -------- http://pastebin.com/bMPvmrwR
Any help, I appreciate it
I figured out it was because I was runnin it with Python 2 and it needs Python 3 … I wiped the server and reinstalled everything but ran all my apps in Python 3 instead of 2 and it worked
Can you share your nginx configuration here?
The most likely reason for a 502 error is if either
You can attempt to reach your service directly on your droplet by using curl or wget to verify it is listening and check your logs for more information.
The more detail you can share here the better we’ll be able to assist you in getting to the bottom of it.
I have exactly the same issue, did you find a solution ?