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.
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.
Answered By – eddys