Issue
I want to use gunicorn for a REST API application with Flask/Python. What is the purpose of adding nginx here to gunicorn? The gunicorn site recommends using gunicorn with nginx.
Solution
Nginx has some web server functionality (e.g., serving static pages; SSL handling) that gunicorn does not, whereas gunicorn implements WSGI (which nginx does not).
… Wait, why do we need two servers? Think of Gunicorn as the
application web server that will be running behind nginx – the front-
facing web server. Gunicorn is WSGI-compatible. It can talk to other
applications that support WSGI, like Flask or Django.
Source: https://realpython.com/blog/python/kickstarting-flask-on-ubuntu-setup-and-deployment/
Answered By – eddys
This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0