server { listen 80; server_name localhost; root /usr/share/nginx/html; index index.html; # Frontend SPA location / { try_files $uri $uri/ /index.html; } # API proxy location /api/ { proxy_pass http://gateway:8888; 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; } # Upload files location /uploads/ { alias /usr/share/nginx/uploads/; expires 30d; add_header Cache-Control "public, immutable"; } # Static assets cache location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ { expires 30d; add_header Cache-Control "public, immutable"; } }