To use nginx with Python, we require the WSGI interface. WSGI is a Python specification which describes how a web server communicates with a Python web application. Nginx does not support WSGI protocol natively. Therefore we require an interface between Nginx and our Python application. One such widely used interface is uWSGI.
Here are step-by-step instructions to use Nginx with Python using uWSGI:
main.py54 chars2 lines
main.py145 chars10 lines
uwsgi.ini
which points to your Flask application entry pointmain.py127 chars9 lines
main.py22 chars2 lines
/etc/nginx/sites-available/default
which proxies requests to the uWSGI socket abovemain.py154 chars10 lines
main.py29 chars2 lines
Now your Python application should be running with Nginx as a reverse proxy.
gistlibby LogSnag