zammad_ssl.conf 2.7 KB

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