Skip to content

Instantly share code, notes, and snippets.

@kvfi
Created July 15, 2019 19:09
Show Gist options
  • Save kvfi/a2a2b5db5985f542d1f1aed8e9a7c647 to your computer and use it in GitHub Desktop.
Save kvfi/a2a2b5db5985f542d1f1aed8e9a7c647 to your computer and use it in GitHub Desktop.
Deployment configuration for Flask
server {
listen 80;
server_name example.com;
location / {
proxy_pass http://unix:/path/to/socket.sock;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
fastcgi_read_timeout 300s;
proxy_read_timeout 300;
}
location /static {
alias /path/to/static/folder
}
error_log /var/log/nginx/example-error.log;
access_log /var/log/nginx/example-access.log;
}
[Unit]
Description=Gunicorn instance to serve flask app
After=network.target
[Service]
User=kvfi
Group=nginx
WorkingDirectory=/path/to/dir
Environment="PATH=/path/to/dir/venv/bin"
ExecStart=/path/to/dir/venv/bin/gunicorn --workers 3 --bind unix:/path/to/dir/flask.sock -m 007 wsgi
[Install]
WantedBy=multi-user.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment