Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
 
 
 
 
 
 

72 lignes
2.3 KiB

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