worker_processes auto; error_log /var/log/nginx/error.log warn; pid /var/run/nginx.pid; events { worker_connections 1024; use epoll; multi_accept on; } 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" "$http_x_forwarded_for"'; access_log /var/log/nginx/access.log main; sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_timeout 65; types_hash_max_size 2048; # Gzip compression gzip on; gzip_vary on; gzip_proxied any; gzip_comp_level 6; gzip_types text/plain text/css text/xml application/json application/javascript application/xml+rss application/atom+xml image/svg+xml; server { listen 80; server_name _; root /usr/share/nginx/html; index index.html; # Security headers add_header X-Frame-Options "SAMEORIGIN" always; add_header X-Content-Type-Options "nosniff" always; add_header X-XSS-Protection "1; mode=block" always; add_header Referrer-Policy "strict-origin-when-cross-origin" always; # Cache static assets location ~* \.(jpg|jpeg|png|gif|ico|svg|webp|woff|woff2|ttf|eot)$ { expires 1y; add_header Cache-Control "public, immutable"; } location ~* \.(css|js)$ { expires 1M; add_header Cache-Control "public"; } # Config files should not be cached long location /config/ { expires 5m; add_header Cache-Control "public, must-revalidate"; } # Admin dashboard location /dashboard { try_files $uri /dashboard.html; } # SPA fallback location / { try_files $uri $uri/ /index.html; } # Health check endpoint location /health { access_log off; return 200 "healthy\n"; add_header Content-Type text/plain; } # Proxy for Immich share pages (to avoid CORS issues) # Usage: /api/immich-proxy?url=https://photography.lisilou.com/s/albumId location /api/immich-proxy { internal; resolver 8.8.8.8 1.1.1.1 valid=300s; resolver_timeout 5s; set $target_url $arg_url; proxy_pass $target_url; proxy_set_header Host $proxy_host; proxy_set_header Accept "text/html"; proxy_ssl_server_name on; } # Booking API — proxy to Node.js service # Immich regex locations above take priority for /api/immich-proxy and /api/fetch-immich/ location /api/ { proxy_pass http://api:3001; 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 30s; } # Proxy endpoint for Immich share pages and API location ~ ^/api/fetch-immich/(.+)$ { resolver 8.8.8.8 1.1.1.1 valid=300s; resolver_timeout 5s; set $immich_path $1; set $immich_host photography.lisilou.com; proxy_pass https://$immich_host/$immich_path$is_args$args; proxy_set_header Host $immich_host; proxy_ssl_server_name on; proxy_ssl_protocols TLSv1.2 TLSv1.3; } } }