Skip to content

Instantly share code, notes, and snippets.

@nedludd0
Last active January 26, 2021 14:35
Show Gist options
  • Select an option

  • Save nedludd0/bc806e44dfc940cd4db53704d9f61322 to your computer and use it in GitHub Desktop.

Select an option

Save nedludd0/bc806e44dfc940cd4db53704d9f61322 to your computer and use it in GitHub Desktop.
nginx-reverse-proxy-flask-app
#### FLASK PROD wsgi python code
location /url_sub_path {
#forward application requests to the wsgi server
proxy_pass http://unix:/var/www/python/flask/flask.sock;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
#### FLASK PROD wsgi python static files
location /url_sub_path/static {
## handle static files directly, without forwarding to the application
alias /var/www/python/flask_app/static;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment