| worker_processes auto; | |
| pid /tmp/nginx.pid; | |
| error_log /tmp/nginx_error.log; | |
| events { | |
| worker_connections 1024; | |
| } | |
| http { | |
| include /etc/nginx/mime.types; | |
| default_type application/octet-stream; | |
| # Temp paths for non-root operation | |
| client_body_temp_path /tmp/client_body; | |
| proxy_temp_path /tmp/proxy; | |
| fastcgi_temp_path /tmp/fastcgi; | |
| uwsgi_temp_path /tmp/uwsgi; | |
| scgi_temp_path /tmp/scgi; | |
| access_log /tmp/nginx_access.log; | |
| sendfile on; | |
| keepalive_timeout 65; | |
| # Gzip compression | |
| gzip on; | |
| gzip_types text/plain text/css application/json application/javascript text/xml application/xml; | |
| server { | |
| listen 7860; | |
| server_name localhost; | |
| root /app/frontend/dist; | |
| index index.html; | |
| # API proxy to Flask backend | |
| location /api/ { | |
| proxy_pass http://127.0.0.1:5000/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 $scheme; | |
| proxy_connect_timeout 120s; | |
| proxy_send_timeout 120s; | |
| proxy_read_timeout 120s; | |
| } | |
| # Serve Vite build assets with cache | |
| location /assets/ { | |
| alias /app/frontend/dist/assets/; | |
| expires 1y; | |
| add_header Cache-Control "public, immutable"; | |
| } | |
| # SPA routing - serve index.html for all other routes | |
| location / { | |
| try_files $uri $uri/ /index.html; | |
| } | |
| } | |
| } | |