zammad_ssl.conf 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. #
  2. # this is an example nginx config for Zammad
  3. # Please visit https://docs.zammad.org for further input on how to configure
  4. # your nginx to work with Zammad
  5. #
  6. upstream zammad-railsserver {
  7. server 127.0.0.1:3000;
  8. }
  9. upstream zammad-websocket {
  10. server 127.0.0.1:6042;
  11. }
  12. server {
  13. listen 80;
  14. listen [::]:80;
  15. server_name example.com;
  16. # security - prevent information disclosure about server version
  17. server_tokens off;
  18. access_log /var/log/nginx/zammad.access.log;
  19. error_log /var/log/nginx/zammad.error.log;
  20. location /.well-known/ {
  21. root /var/www/html;
  22. }
  23. return 301 https://$server_name$request_uri;
  24. }
  25. server {
  26. listen 443 ssl http2;
  27. listen [::]:443 ssl http2;
  28. server_name example.com;
  29. # security - prevent information disclosure about server version
  30. server_tokens off;
  31. ssl_certificate /etc/ssl/certs/example.com.pem;
  32. ssl_certificate_key /etc/ssl/private/example.com.key;
  33. ssl_trusted_certificate /etc/ssl/certs/root-ca-plus-intermediates.pem;
  34. ssl_dhparam /etc/ssl/dhparam.pem;
  35. ssl_protocols TLSv1.2 TLSv1.3;
  36. ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-CHACHA20-POLY1305;
  37. ssl_prefer_server_ciphers off;
  38. ssl_session_cache shared:SSL:10m;
  39. ssl_session_timeout 180m;
  40. ssl_session_tickets off;
  41. ssl_stapling on;
  42. ssl_stapling_verify on;
  43. # Use your prefered resolver - also allows external like 1.1.1.1 and 8.8.8.8
  44. resolver 127.0.0.1;
  45. add_header Strict-Transport-Security "max-age=63072000" always;
  46. location = /robots.txt {
  47. access_log off; log_not_found off;
  48. }
  49. location = /favicon.ico {
  50. access_log off; log_not_found off;
  51. }
  52. root /opt/zammad/public;
  53. access_log /var/log/nginx/zammad.access.log;
  54. error_log /var/log/nginx/zammad.error.log;
  55. client_max_body_size 50M;
  56. location ~ ^/(assets/|robots.txt|humans.txt|favicon.ico|apple-touch-icon.png) {
  57. expires max;
  58. }
  59. # legacy web socket server
  60. location /ws {
  61. proxy_http_version 1.1;
  62. proxy_set_header Upgrade $http_upgrade;
  63. proxy_set_header Connection "Upgrade";
  64. proxy_set_header CLIENT_IP $remote_addr;
  65. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  66. proxy_set_header X-Forwarded-Proto $scheme;
  67. proxy_read_timeout 86400;
  68. proxy_pass http://zammad-websocket;
  69. }
  70. # action cable
  71. location /cable {
  72. proxy_http_version 1.1;
  73. proxy_set_header Upgrade $http_upgrade;
  74. proxy_set_header Connection "Upgrade";
  75. proxy_set_header CLIENT_IP $remote_addr;
  76. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  77. proxy_set_header X-Forwarded-Proto $scheme;
  78. proxy_read_timeout 86400;
  79. proxy_pass http://zammad-railsserver;
  80. }
  81. location / {
  82. proxy_set_header Host $http_host;
  83. proxy_set_header CLIENT_IP $remote_addr;
  84. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  85. proxy_set_header X-Forwarded-Proto $scheme;
  86. # change this line in an SSO setup
  87. proxy_set_header X-Forwarded-User "";
  88. proxy_read_timeout 180;
  89. proxy_pass http://zammad-railsserver;
  90. gzip on;
  91. gzip_types text/plain text/xml text/css image/svg+xml application/javascript application/x-javascript application/json application/xml;
  92. gzip_proxied any;
  93. }
  94. }