worker_processes 1; pid /tmp/nginx.pid; error_log /var/log/nginx/error.log warn; events { worker_connections 1024; } http { include /etc/nginx/mime.types; default_type application/octet-stream; # All temp paths under /tmp so non-root uid=1000 never hits permission errors client_body_temp_path /tmp/nginx_client_body; proxy_temp_path /tmp/nginx_proxy; fastcgi_temp_path /tmp/nginx_fastcgi; uwsgi_temp_path /tmp/nginx_uwsgi; scgi_temp_path /tmp/nginx_scgi; sendfile on; tcp_nopush on; keepalive_timeout 65; server_tokens off; # Compression: cuts the SPA payload by ~65-75% gzip on; gzip_vary on; gzip_min_length 1024; gzip_comp_level 5; gzip_types text/plain text/css application/javascript application/json application/xml image/svg+xml; gzip_proxied any; upstream httpsms_api { server 127.0.0.1:8000; } server { listen 7860; server_name _; access_log /var/log/nginx/access.log; # Go Fiber API: /v1/* plus heartbeat/health routes (WebSocket/SSE aware) location ~* ^/(v1|heartbeat|health)(/|$) { proxy_pass http://httpsms_api; 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 https; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_read_timeout 3600s; } # Android APK direct download location = /HttpSms.apk { alias /usr/share/nginx/html/HttpSms.apk; default_type application/vnd.android.package-archive; add_header Content-Disposition 'attachment; filename="HttpSms.apk"'; add_header Cache-Control "public, max-age=3600"; } # Hashed Nuxt build assets: content-addressed, cache forever location ^~ /_nuxt/ { root /usr/share/nginx/html; try_files $uri =404; add_header Cache-Control "public, max-age=31536000, immutable"; } # Other static assets: public short cache location ~* \.(?:css|js|svg|png|jpg|jpeg|gif|webp|ico|woff2?|ttf|eot|xlsx|csv)$ { root /usr/share/nginx/html; try_files $uri =404; add_header Cache-Control "public, max-age=2592000"; } # HTML: always revalidate so new builds propagate location ~* \.html$ { root /usr/share/nginx/html; try_files $uri =404; add_header Cache-Control "no-cache"; } # Nuxt static SPA with client-side routing fallback location / { root /usr/share/nginx/html; try_files $uri $uri/ /index.html; } } }