events{} http { include /etc/nginx/mime.types; client_max_body_size 100m; server_tokens off; add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" always; add_header X-Content-Type-Options "nosniff" always; server { listen 80; server_name localhost; root /usr/share/nginx/html; index index.html; error_page 404 /404.html; location = /404.html { root /usr/share/nginx/html; try_files $uri $uri/ /index.html; } location /socket.io { proxy_pass http://localhost:3000/socket.io; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "Upgrade"; proxy_set_header Host $host; proxy_read_timeout 900s; proxy_send_timeout 900s; } location ~* ^/(?!api/).*.(css|js|jpg|jpeg|png|gif|ico|svg)$ { root /usr/share/nginx/html; add_header Expires "0"; add_header Cache-Control "public, max-age=31536000, immutable"; } # Use the default language for the root of the application location / { root /usr/share/nginx/html; try_files $uri $uri/ /index.html?$args; } location /api/ { proxy_pass http://localhost:3000/; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "Upgrade"; proxy_set_header Host $host; proxy_read_timeout 900s; proxy_send_timeout 900s; # SSE specific settings proxy_buffering off; proxy_cache off; } } }