server { listen 80; server_name localhost; root /usr/share/nginx/html; index index.html; # Enable gzip compression gzip on; gzip_types text/plain text/css application/json application/javascript text/xml application/xml text/javascript; # Handle all specified routes location / { try_files $uri $uri/ /index.html; } location /home { try_files $uri $uri/ /index.html; } location /experience { try_files $uri $uri/ /index.html; } location /interest { try_files $uri $uri/ /index.html; } location /project { try_files $uri $uri/ /index.html; } # Cache static assets location /static/ { expires 1y; add_header Cache-Control "public, no-transform"; } # Deny access to . files location ~ /\. { deny all; } }