Spaces:
Running
Running
| # Server block | |
| server { | |
| listen 80; | |
| server_name localhost; | |
| # Disable access logging to avoid permission issues | |
| access_log /dev/stdout; | |
| error_log /dev/stderr; | |
| # Serve static files | |
| location / { | |
| root /usr/share/nginx/html; | |
| index index.html index.htm; | |
| try_files $uri $uri/ =404; | |
| } | |
| # Proxy API requests to the backend (same container) | |
| location /api/ { | |
| proxy_pass http://127.0.0.1:8501/; | |
| proxy_http_version 1.1; | |
| proxy_set_header Upgrade $http_upgrade; | |
| proxy_set_header Connection 'upgrade'; | |
| 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_cache_bypass $http_upgrade; | |
| } | |
| # Health check endpoint | |
| location /health { | |
| access_log off; | |
| return 200 "healthy\n"; | |
| add_header Content-Type text/plain; | |
| } | |
| error_page 404 /404.html; | |
| location = /404.html { | |
| internal; | |
| root /usr/share/nginx/html; | |
| } | |
| error_page 500 502 503 504 /50x.html; | |
| location = /50x.html { | |
| root /usr/share/nginx/html; | |
| } | |
| } |