server { listen 80 default_server; server_name _; client_max_body_size 10G; # Downloads directory (installers, packages) location /downloads/ { alias /opt/depl0y/static/downloads/; autoindex on; autoindex_exact_size off; autoindex_localtime on; add_header Content-Type "application/octet-stream"; # Disable caching for installers and packages add_header Cache-Control "no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0" always; add_header Pragma "no-cache" always; add_header Expires "0" always; } # Install script (legacy support) location = /install.sh { alias /opt/depl0y/static/downloads/install.sh; default_type text/plain; add_header Content-Type "text/plain; charset=utf-8"; # Disable caching for installer add_header Cache-Control "no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0" always; add_header Pragma "no-cache" always; add_header Expires "0" always; } # Hashed JS/CSS assets — long-term cache (content-addressed, safe) location ~* ^/assets/.*\.(js|css)$ { root /opt/depl0y/frontend/dist; add_header Cache-Control "public, max-age=31536000, immutable"; try_files $uri =404; } # SPA — never cache HTML; try_files fallback to index.html must also be uncached location / { root /opt/depl0y/frontend/dist; try_files $uri $uri/ /index.html; add_header Cache-Control "no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0" always; add_header Pragma "no-cache" always; add_header Expires "0" always; } # Backend API location /api { proxy_pass http://127.0.0.1:8000; 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_http_version 1.1; proxy_connect_timeout 300s; proxy_send_timeout 300s; proxy_read_timeout 300s; # Disable caching for API responses proxy_cache_bypass 1; proxy_no_cache 1; add_header Cache-Control "no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0" always; add_header Pragma "no-cache" always; add_header Expires "0" always; } location /health { proxy_pass http://127.0.0.1:8000/health; access_log off; } }