zammad_ssl.conf 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. #
  2. # this is an example nginx config for using SSL with zammad
  3. # this can be adjusted to be used with self-signed, trusted ca and letsencrypt certs
  4. # this example uses letsencrypt certs. replace all occurrences of example.com with your domain
  5. # If using LetsEncrypt create letsencrypt certificate by: certbot certonly --webroot -w /var/www/html -d www.example.com
  6. # create dhparam.pem by: openssl dhparam -out /etc/nginx/ssl/dhparam.pem 4096
  7. # download LetsEncrypt x3 certificate by: wget -q https://letsencrypt.org/certs/lets-encrypt-x3-cross-signed.pem -P /etc/nginx/ssl
  8. # you can test your ssl configuration @ https://www.ssllabs.com/ssltest/analyze.html
  9. #
  10. upstream zammad-railsserver {
  11. server 127.0.0.1:3000;
  12. }
  13. upstream zammad-websocket {
  14. server 127.0.0.1:6042;
  15. }
  16. server {
  17. listen 80;
  18. listen [::]:80;
  19. server_name example.com;
  20. # security - prevent information disclosure about server version
  21. server_tokens off;
  22. access_log /var/log/nginx/zammad.access.log;
  23. error_log /var/log/nginx/zammad.error.log;
  24. location /.well-known/ {
  25. root /var/www/html;
  26. }
  27. return 301 https://$server_name$request_uri;
  28. }
  29. server {
  30. listen 443 ssl http2;
  31. listen [::]:443 ssl http2;
  32. server_name example.com;
  33. # security - prevent information disclosure about server version
  34. server_tokens off;
  35. ssl_certificate /etc/nginx/ssl/example.com-fullchain.pem;
  36. ssl_certificate_key /etc/nginx/ssl/example.com-privkey.pem;
  37. ssl_protocols TLSv1.2;
  38. ssl_ciphers 'EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH';
  39. ssl_dhparam /etc/nginx/ssl/dhparam.pem;
  40. ssl_prefer_server_ciphers on;
  41. ssl_session_cache shared:SSL:10m;
  42. ssl_session_timeout 180m;
  43. ssl_stapling on;
  44. ssl_stapling_verify on;
  45. ssl_trusted_certificate /etc/nginx/ssl/lets-encrypt-x3-cross-signed.pem;
  46. resolver 8.8.8.8 8.8.4.4;
  47. add_header Strict-Transport-Security "max-age=31536000" always;
  48. location = /robots.txt {
  49. access_log off; log_not_found off;
  50. }
  51. location = /favicon.ico {
  52. access_log off; log_not_found off;
  53. }
  54. root /opt/zammad/public;
  55. access_log /var/log/nginx/zammad.access.log;
  56. error_log /var/log/nginx/zammad.error.log;
  57. client_max_body_size 50M;
  58. location ~ ^/(assets/|robots.txt|humans.txt|favicon.ico|apple-touch-icon.png) {
  59. expires max;
  60. }
  61. # legacy web socket server
  62. location /ws {
  63. proxy_http_version 1.1;
  64. proxy_set_header Upgrade $http_upgrade;
  65. proxy_set_header Connection "Upgrade";
  66. proxy_set_header CLIENT_IP $remote_addr;
  67. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  68. proxy_set_header X-Forwarded-Proto $scheme;
  69. proxy_read_timeout 86400;
  70. proxy_pass http://zammad-websocket;
  71. }
  72. # action cable
  73. location /cable {
  74. proxy_http_version 1.1;
  75. proxy_set_header Upgrade $http_upgrade;
  76. proxy_set_header Connection "Upgrade";
  77. proxy_set_header CLIENT_IP $remote_addr;
  78. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  79. proxy_set_header X-Forwarded-Proto $scheme;
  80. proxy_read_timeout 86400;
  81. proxy_pass http://zammad-railsserver;
  82. }
  83. location / {
  84. proxy_set_header Host $http_host;
  85. proxy_set_header CLIENT_IP $remote_addr;
  86. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  87. proxy_set_header X-Forwarded-Proto $scheme;
  88. # change this line in an SSO setup
  89. proxy_set_header X-Forwarded-User "";
  90. proxy_read_timeout 180;
  91. proxy_pass http://zammad-railsserver;
  92. gzip on;
  93. gzip_types text/plain text/xml text/css image/svg+xml application/javascript application/x-javascript application/json application/xml;
  94. gzip_proxied any;
  95. }
  96. }