worker_processes auto; error_log /var/log/nginx/error.log warn; pid /var/run/nginx.pid; events { worker_connections 1024; } http { include /etc/nginx/mime.types; default_type application/octet-stream; log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent"'; access_log /var/log/nginx/access.log main; sendfile on; tcp_nopush on; keepalive_timeout 65; gzip on; gzip_types text/plain text/css application/json application/javascript text/xml application/xml; # Upstream servers upstream api { server 127.0.0.1:3000; } upstream webdav { server 127.0.0.1:8080; } server { listen 80; server_name _; # Welcome page at root location = / { root /app/welcome; try_files /welcome.html =404; } # Redirect /stats to /stats/ location = /stats { return 301 /stats/; } # VFS Statistics dashboard (React SPA) location /stats/ { alias /app/ui/; index index.html; try_files $uri $uri/ /stats/index.html; } # Static assets for stats dashboard location /assets/ { alias /app/ui/assets/; expires 1y; add_header Cache-Control "public, immutable"; } # API routes location /api/ { proxy_pass http://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; } # Health check (direct to API) location /health { proxy_pass http://api/health; proxy_http_version 1.1; proxy_set_header Host $host; } # WebDAV endpoint location /webdav { proxy_pass http://webdav/webdav; 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 Destination $http_destination; proxy_set_header Depth $http_depth; proxy_buffering off; client_max_body_size 0; # WebDAV methods dav_methods PUT DELETE MKCOL COPY MOVE; # Timeouts for large file operations proxy_connect_timeout 300; proxy_send_timeout 300; proxy_read_timeout 300; } } }