Deployment issue with guinicorn and ngninx

Good evening dear all,

I just deployed my first django application on a server within my local network. The application runs on gunicorn and is hosted on nginx.
I connect to the server from my remote home computer via ssh, when I run “./manage.py runserver” from the terminal (ssh) everything is fine and the application is running fine. But when I close the terminal, the application is no longer accessible from the browser. The error message is “502 Bad Gateway nginx / 1.18.0 (Ubuntu)”.
How do I run my application even when the remote ssh terminal is closed and then my personal computer might be turned off.

thank you in advance

You need to ensure that gunicorn is running and that nginx is connecting to it. It sounds like you’ve got nginx set up to connect to your runserver port. Exactly how you do that (start gunicorn as a daemon), is going to depend a lot upon what your server is running.

1 Like