default.conf.template 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. server {
  2. listen 80 default_server;
  3. location ^~ / {
  4. root /usr/share/nginx/html;
  5. index index.html index.htm;
  6. try_files $uri $uri/ /index.html;
  7. }
  8. location @router {
  9. rewrite ^.*$ /index.html last; # important!
  10. }
  11. location ~* \.(?:manifest|appcache|html?|xml|json)$ {
  12. root /usr/share/nginx/html;
  13. if ($request_uri ~* .*[.](manifest|appcache|xml|json)$) {
  14. add_header Cache-Control "public, max-age=2592000";
  15. }
  16. if ($request_filename ~* ^.*[.](html|htm)$) {
  17. add_header Cache-Control "public, no-cache";
  18. }
  19. expires -1;
  20. }
  21. location ~* \.(?:js|css|map|jpg|png|svg|ico)$ {
  22. root /usr/share/nginx/html;
  23. try_files $uri =404;
  24. expires 1y;
  25. access_log off;
  26. add_header Cache-Control "public";
  27. }
  28. location ~ ^.+\..+$ {
  29. root /usr/share/nginx/html;
  30. try_files $uri =404;
  31. include /etc/nginx/mime.types;
  32. }
  33. error_page 500 502 503 504 /50x.html;
  34. location = /50x.html {
  35. root /usr/share/nginx/html;
  36. }
  37. }