zammad_ssl.conf 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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 localhost:3000;
  12. }
  13. upstream zammad-websocket {
  14. server localhost:6042;
  15. }
  16. server {
  17. listen 80;
  18. server_name example.com;
  19. access_log /var/log/nginx/zammad.access.log;
  20. error_log /var/log/nginx/zammad.error.log;
  21. location /.well-known/ {
  22. root /var/www/html;
  23. }
  24. location / {
  25. rewrite ^/(.*)$ https://example.com/$1 permanent;
  26. }
  27. }
  28. server {
  29. listen 443 ssl http2;
  30. server_name example.com;
  31. ssl_certificate /etc/nginx/ssl/example.com-fullchain.pem;
  32. ssl_certificate_key /etc/nginx/ssl/example.com-privkey.pem;
  33. ssl_protocols TLSv1.2;
  34. ssl_ciphers 'EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH';
  35. ssl_dhparam /etc/nginx/ssl/dhparam.pem;
  36. ssl_prefer_server_ciphers on;
  37. ssl_session_cache shared:SSL:10m;
  38. ssl_session_timeout 180m;
  39. ssl_stapling on;
  40. ssl_stapling_verify on;
  41. ssl_trusted_certificate /etc/nginx/ssl/lets-encrypt-x3-cross-signed.pem;
  42. resolver 8.8.8.8 8.8.4.4;
  43. add_header Strict-Transport-Security "max-age=31536000" always;
  44. location = /robots.txt {
  45. access_log off; log_not_found off;
  46. }
  47. location = /favicon.ico {
  48. access_log off; log_not_found off;
  49. }
  50. root /opt/zammad/public;
  51. access_log /var/log/nginx/zammad.access.log;
  52. error_log /var/log/nginx/zammad.error.log;
  53. client_max_body_size 50M;
  54. location ~ ^/(assets/|robots.txt|humans.txt|favicon.ico) {
  55. expires max;
  56. }
  57. location /ws {
  58. proxy_http_version 1.1;
  59. proxy_set_header Upgrade $http_upgrade;
  60. proxy_set_header Connection "Upgrade";
  61. proxy_set_header CLIENT_IP $remote_addr;
  62. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  63. proxy_read_timeout 86400;
  64. proxy_pass http://zammad-websocket;
  65. }
  66. location / {
  67. proxy_set_header Host $http_host;
  68. proxy_set_header CLIENT_IP $remote_addr;
  69. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  70. proxy_read_timeout 180;
  71. proxy_pass http://zammad-railsserver;
  72. gzip on;
  73. gzip_types text/plain text/xml text/css image/svg+xml application/javascript application/x-javascript application/json application/xml;
  74. gzip_proxied any;
  75. }
  76. }