productionize
This commit is contained in:
59
nginx.conf.example
Normal file
59
nginx.conf.example
Normal file
@@ -0,0 +1,59 @@
|
||||
# Example nginx configuration for production deployment
|
||||
# This reverse proxies to the Flask app running in Docker
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
server_name trivia.torrtle.co;
|
||||
|
||||
# Redirect HTTP to HTTPS
|
||||
return 301 https://$server_name$request_uri;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 443 ssl http2;
|
||||
server_name trivia.torrtle.co;
|
||||
|
||||
# SSL certificate configuration (adjust paths as needed)
|
||||
ssl_certificate /etc/letsencrypt/live/trivia.torrtle.co/fullchain.pem;
|
||||
ssl_certificate_key /etc/letsencrypt/live/trivia.torrtle.co/privkey.pem;
|
||||
|
||||
# SSL security settings
|
||||
ssl_protocols TLSv1.2 TLSv1.3;
|
||||
ssl_ciphers HIGH:!aNULL:!MD5;
|
||||
ssl_prefer_server_ciphers on;
|
||||
|
||||
# Client upload size (for image uploads)
|
||||
client_max_body_size 10M;
|
||||
|
||||
# Proxy to Flask app
|
||||
location / {
|
||||
proxy_pass http://localhost:5001;
|
||||
proxy_http_version 1.1;
|
||||
|
||||
# Standard proxy headers
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_set_header X-Forwarded-Host $server_name;
|
||||
|
||||
# WebSocket support for Socket.IO
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
|
||||
# Timeouts for WebSocket connections
|
||||
proxy_connect_timeout 7d;
|
||||
proxy_send_timeout 7d;
|
||||
proxy_read_timeout 7d;
|
||||
}
|
||||
|
||||
# Optional: Separate location block for Celery Flower monitoring
|
||||
location /flower/ {
|
||||
proxy_pass http://localhost:5555/;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user