server { listen 80; server_name _; root /usr/share/nginx/html; index index.html; # Static assets location = /sw.js { add_header Cache-Control "no-cache, no-store, must-revalidate" always; try_files $uri =404; } location = /styles/global.css { add_header Cache-Control "no-cache" always; try_files $uri =404; } location / { # Serve directory index pages without requiring a trailing slash. # This fixes /videos (and similar) resolving to /videos/index.html. try_files $uri $uri/index.html $uri/ =404; } }