nginx.conf.template 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. upstream %(proj_name)s {
  2. server unix:%(proj_path)s/gunicorn.sock fail_timeout=0;
  3. }
  4. server {
  5. listen 80;
  6. %(ssl_disabled)s listen 443 ssl;
  7. server_name %(domains_nginx)s;
  8. client_max_body_size 10M;
  9. keepalive_timeout 15;
  10. error_log /home/%(user)s/logs/%(proj_name)s_error_nginx.log info;
  11. %(ssl_disabled)s ssl_certificate conf/%(proj_name)s.crt;
  12. %(ssl_disabled)s ssl_certificate_key conf/%(proj_name)s.key;
  13. %(ssl_disabled)s ssl_session_cache shared:SSL:10m;
  14. %(ssl_disabled)s ssl_session_timeout 10m;
  15. %(ssl_disabled)s ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA;
  16. %(ssl_disabled)s ssl_prefer_server_ciphers on;
  17. %(ssl_disabled)s ssl_protocols TLSv1.2 TLSv1.1 TLSv1;
  18. # Deny illegal Host headers
  19. if ($host !~* ^(%(domains_regex)s)$) {
  20. return 444;
  21. }
  22. location / {
  23. proxy_redirect off;
  24. proxy_set_header Host $host;
  25. proxy_set_header X-Real-IP $remote_addr;
  26. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  27. proxy_set_header X-Forwarded-Protocol $scheme;
  28. proxy_pass http://%(proj_name)s;
  29. }
  30. location /static/ {
  31. root %(proj_path)s;
  32. access_log off;
  33. log_not_found off;
  34. expires 30d;
  35. }
  36. location /robots.txt {
  37. root %(proj_path)s/static;
  38. access_log off;
  39. log_not_found off;
  40. }
  41. location /favicon.ico {
  42. root %(proj_path)s/static/img;
  43. access_log off;
  44. log_not_found off;
  45. }
  46. }