server { listen 80; server_name bastebin.com www.bastebin.com; # Static files serving - offload from Flask/Gunicorn location /static/ { alias /home/computertech/bastebin/static/; expires 30d; add_header Cache-Control "public, no-transform"; } # Proxy all other requests to Gunicorn location / { proxy_pass http://127.0.0.1:5500; # 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; # Timeouts and keeping connections alive proxy_http_version 1.1; proxy_set_header Connection ""; proxy_connect_timeout 90; proxy_send_timeout 90; proxy_read_timeout 90; # Max payload size (matching 2MB config or slightly above) client_max_body_size 5M; # Buffer settings proxy_buffers 16 16k; proxy_buffer_size 32k; } # Log files - ensure these directories exist or use /var/log/nginx access_log /var/log/nginx/bastebin.access.log; error_log /var/log/nginx/bastebin.error.log; }