選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。
 
 
 
 
 
 

74 行
2.1 KiB

  1. server {
  2. listen 80;
  3. {% if domain %}
  4. server_name {{ domain }} www.{{ domain }};
  5. {% else %}
  6. server_name localhost;
  7. {% endif %}
  8. return 301 https://$server_name$request_uri;
  9. }
  10. server {
  11. listen 443 ssl http2;
  12. listen [::]:443 ssl http2;
  13. ssl_certificate /etc/ssl/certs/certificate.crt;
  14. ssl_certificate_key /etc/ssl/private/private.key;
  15. ssl_session_timeout 30m;
  16. ssl_session_cache shared:SSL:20m;
  17. ssl_session_tickets off;
  18. {% if dhparam %}
  19. # Diffie-Hellman parameter for DHE ciphersuites, recommended 2048 bits
  20. ssl_dhparam /etc/ssl/certs/dhparam.pem;
  21. {% endif %}
  22. # modern configuration. tweak to your needs.
  23. ssl_protocols TLSv1.2;
  24. ssl_ciphers 'ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256';
  25. ssl_prefer_server_ciphers on;
  26. # HSTS (ngx_http_headers_module is required) (15768000 seconds = 6 months)
  27. add_header Strict-Transport-Security max-age=15768000;
  28. {% if ssl_trusted_certificate %}
  29. # OCSP Stapling ---
  30. # fetch OCSP records from URL in ssl_certificate and cache them
  31. ssl_stapling on;
  32. ssl_stapling_verify on;
  33. ## verify chain of trust of OCSP response using Root CA and Intermediate certs
  34. ssl_trusted_certificate /etc/ssl/certs/ca.crt;
  35. resolver 8.8.8.8 8.8.4.4 208.67.222.222 208.67.220.220 valid=300s;
  36. {% endif %}
  37. proxy_set_header Host $host;
  38. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  39. proxy_set_header X-Forwarded-Proto $scheme;
  40. proxy_set_header X-Real-IP $remote_addr;
  41. proxy_redirect off;
  42. location / {
  43. proxy_pass http://frontend:8080;
  44. }
  45. location /admin/ {
  46. proxy_pass http://backend:8000;
  47. }
  48. location /backend/ {
  49. proxy_pass http://backend:8000;
  50. }
  51. location /static/ {
  52. autoindex on;
  53. root /backend/www;
  54. }
  55. location /media/ {
  56. autoindex on;
  57. root /backend/www;
  58. }
  59. }