server { listen 8080; server_name localhost; root /usr/share/nginx/html; index index.html; # Serve static assets directly location ~* \.(?:css|js|map|jpe?g|gif|png|svg|woff2?|ico)$ { } # All other requests return 503 maintenance page location / { if (-f $document_root/index.html) { return 503; } } error_page 503 @maintenance; location @maintenance { rewrite ^(.*)$ /index.html break; } }