説明なし

nginx.conf 3.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. user nobody nogroup;
  2. worker_processes auto; # auto-detect number of logical CPU cores
  3. events {
  4. worker_connections 512; # set the max number of simultaneous connections (per worker process)
  5. }
  6. http {
  7. client_max_body_size 250M;
  8. include mime.types;
  9. # thanks stackoverflow http://stackoverflow.com/a/5132440/2406040
  10. gzip on;
  11. gzip_http_version 1.1;
  12. gzip_vary on;
  13. gzip_comp_level 6;
  14. gzip_proxied any;
  15. gzip_types text/plain text/css application/json application/javascript application/x-javascript text/javascript text/xml application/xml application/rss+xml application/atom+xml application/rdf+xml;
  16. # make sure gzip does not lose large gzipped js or css files
  17. # see http://blog.leetsoft.com/2007/07/25/nginx-gzip-ssl.html
  18. gzip_buffers 16 8k;
  19. # Disable gzip for certain browsers.
  20. gzip_disable "MSIE [1-6].(?!.*SV1)";
  21. server {
  22. listen 80;
  23. server_name "localhost";
  24. #location /static/js/* {
  25. # # avoid clickjacking
  26. # add_header X-Frame-Options DENY;
  27. # add_header X-Content-Type-Options nosniff;
  28. # add_header ;
  29. # # block MIME sniffing
  30. # # security headers
  31. # add_header X-XSS-Protection "1; mode=block";
  32. # # add_header Content-Security-Policy "default-src 'self'";
  33. # add_header Referrer-Policy "no-referrer";
  34. # server_tokens off;
  35. # root /usr/share/nginx/html;
  36. # gzip_static on;
  37. # expires 1y;
  38. # add_header Cache-Control public;
  39. # add_header ETag "";
  40. # try_files $uri /index.html;
  41. #}
  42. location / {
  43. # avoid clickjacking
  44. add_header X-Frame-Options DENY;
  45. # block MIME sniffing
  46. add_header X-Content-Type-Options nosniff;
  47. # security headers
  48. add_header X-XSS-Protection "1; mode=block";
  49. # add_header Content-Security-Policy "default-src 'self'";
  50. add_header Referrer-Policy "no-referrer";
  51. server_tokens off;
  52. root /usr/share/nginx/html;
  53. gzip_static on;
  54. expires 1y;
  55. add_header Cache-Control public;
  56. add_header ETag "";
  57. try_files $uri /index.html;
  58. }
  59. location ~ /api/v(1|2) {
  60. proxy_pass http://${BACKEND_HOSTNAME}:5001;
  61. proxy_buffering off;
  62. proxy_http_version 1.1;
  63. proxy_connect_timeout 900;
  64. proxy_send_timeout 900;
  65. proxy_read_timeout 900;
  66. send_timeout 900;
  67. }
  68. }
  69. server {
  70. listen 443 ssl;
  71. server_name "localhost";
  72. ssl_certificate fullchain.cert.pem;
  73. ssl_certificate_key privkey.pem;
  74. ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
  75. ssl_ciphers HIGH:!aNULL:!MD5;
  76. location / {
  77. # avoid clickjacking
  78. add_header X-Frame-Options DENY;
  79. # block MIME sniffing
  80. add_header X-Content-Type-Options nosniff;
  81. # security headers
  82. add_header X-XSS-Protection "1; mode=block";
  83. # add_header Content-Security-Policy "default-src 'self'";
  84. add_header Referrer-Policy "no-referrer";
  85. server_tokens off;
  86. root /usr/share/nginx/html;
  87. gzip_static on;
  88. expires 1y;
  89. add_header Cache-Control public;
  90. add_header ETag "";
  91. try_files $uri /index.html;
  92. }
  93. # Get the hostname from environment here?
  94. location ~ /api/v(1|2) {
  95. proxy_pass http://${BACKEND_HOSTNAME}:5001;
  96. proxy_buffering off;
  97. proxy_http_version 1.1;
  98. proxy_connect_timeout 900;
  99. proxy_send_timeout 900;
  100. proxy_read_timeout 900;
  101. send_timeout 900;
  102. }
  103. }
  104. }