What is the correct way to leave gunicorn running?

nickponline picture nickponline · Dec 1, 2012 · Viewed 33.1k times · Source

I want to make a Flask+Nginx+Gunicorn deployment. I have Nginx setup and running and I run gunicorn as described in the docs:

gunicorn app:app

But when I logout of the server the gunicorn process exits? What is the correct way to make sure it stay running for Nginx to connect to, and restarts if it crashes?

Answer

zhiguo.wang picture zhiguo.wang · May 28, 2015

Use --daemon option while running gunicorn. Example:

gunicorn grand56.wsgi:application --name grand56 --workers 3 --user=root --group=root --bind=127.0.0.1:1001 --daemon