statichtmlsite.conf 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. # Expires map
  2. map $sent_http_content_type $expires {
  3. default off;
  4. text/html epoch;
  5. text/css max;
  6. application/javascript max;
  7. ~image/ max;
  8. }
  9. server {
  10. listen 80;
  11. listen [::]:80;
  12. server_name ${SERVICE_DOMAIN};
  13. return 301 https://$http_host$request_uri;
  14. add_header X-Content-Type-Options "nosniff" always;
  15. add_header X-XSS-Protection "1; mode=block" always;
  16. add_header X-Frame-Options "DENY" always;
  17. add_header Referrer-Policy "strict-origin" always;
  18. add_header Strict-Transport-Security "max-age=31536000; includeSubDomains";
  19. server_tokens off;
  20. }
  21. server {
  22. server_name ${SERVICE_DOMAIN};
  23. root /var/www/html/${SERVICE_DOMAIN};
  24. index index.html index.htm;
  25. listen 443 ssl;
  26. # listen [::]:443 ipv6only=on ssl;
  27. ssl_certificate /etc/nginx/ssl/${SERVICE_DOMAIN}/cert.pem;
  28. ssl_certificate_key /etc/nginx/ssl/${SERVICE_DOMAIN}/key.pem;
  29. include /etc/nginx/includes/ssl.conf;
  30. add_header X-Content-Type-Options "nosniff" always;
  31. add_header X-XSS-Protection "1; mode=block" always;
  32. add_header X-Frame-Options "DENY" always;
  33. add_header Referrer-Policy "strict-origin" always;
  34. add_header Strict-Transport-Security "max-age=31536000; includeSubDomains";
  35. server_tokens off;
  36. include /etc/nginx/includes/gzip.conf;
  37. location / {
  38. #try_files $uri $uri/ =404;
  39. try_files $uri $uri/ /index.php?q=$uri&$args;
  40. }
  41. expires $expires;
  42. location ~* \.(js|css|xml|gz)$ {
  43. add_header Vary "Accept-Encoding";
  44. }
  45. # custom error pages
  46. fastcgi_intercept_errors on; # make custom errors work
  47. error_page 500 502 503 504 /errors/50x.html;
  48. location = /50x.html {
  49. root /var/www/errors;
  50. }
  51. error_page 403 /errors/403.html;
  52. location = /403.html {
  53. root /var/www/errors;
  54. }
  55. error_page 404 /errors/404.html;
  56. location = /404.html {
  57. }
  58. location ^~ /.well-known/ {
  59. access_log off;
  60. log_not_found off;
  61. root /var/www/html;
  62. # autoindex off;
  63. index index.html; # "no-such-file.txt",if expected protos don't need it
  64. try_files $uri $uri/ =404;
  65. }
  66. }