Running a Flask app with nginx

I just read an overly complicated blog post on how to use nginx with Flask and wanted to tell the simple story so it wouldn't scare people away from using two of my favorite tools.

It is amazingly simple to do this.


  • Have Flask installed (use pip).
  • Have Gunicorn installed (use pip).
  • Have nginx installed (should be in your package manager).

Write a Flask app.

Add this to your nginx config:

server {


    location / {


Test your config and restart nginx:

sudo nginx -t
sudo nginx -s reload

Run your app under gunicorn:

gunicorn filename:appname -b

That's all there is to it.

Comments !