server { listen 80; server_name YOUR_DOMAIN www.YOUR_DOMAIN; # Certbot will automatically add HTTPS redirect and SSL config below this line root /opt/lunarfront/packages/admin/dist; index index.html; # Proxy API requests to Bun backend location /v1/ { proxy_pass http://localhost:8000; 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_read_timeout 60s; client_max_body_size 20M; } # WebDAV passthrough (all HTTP methods) location /webdav/ { proxy_pass http://localhost:8000; 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_read_timeout 120s; client_max_body_size 100M; } # SPA fallback — serve index.html for all unmatched paths location / { try_files $uri $uri/ /index.html; } # Cache hashed static assets aggressively location /assets/ { expires 1y; add_header Cache-Control "public, immutable"; } gzip on; gzip_vary on; gzip_types text/plain text/css application/json application/javascript text/xml application/xml image/svg+xml; }