nginx.conf 939 B

1234567891011121314151617181920212223242526272829303132
  1. server {
  2. listen 80;
  3. server_name localhost;
  4. root /usr/share/nginx/html;
  5. index index.html index.htm;
  6. # Enable gzip compression
  7. gzip on;
  8. gzip_vary on;
  9. gzip_min_length 1024;
  10. gzip_types text/plain text/css text/xml text/javascript application/javascript application/xml+rss application/json;
  11. # Handle client routing, return index.html for any non-file requests
  12. location / {
  13. try_files $uri $uri/ /index.html;
  14. }
  15. # Cache static assets
  16. location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg)$ {
  17. expires 1y;
  18. add_header Cache-Control "public, immutable";
  19. }
  20. # Security headers
  21. add_header X-Frame-Options "SAMEORIGIN" always;
  22. add_header X-Content-Type-Options "nosniff" always;
  23. add_header X-XSS-Protection "1; mode=block" always;
  24. add_header Referrer-Policy "strict-origin-when-cross-origin" always;
  25. # Disable server tokens
  26. server_tokens off;
  27. }