2017-01-29 10:01:53 +00:00
|
|
|
#
|
2018-06-13 09:22:48 +00:00
|
|
|
# this is an example nginx config for using SSL with zammad
|
2018-07-18 14:39:11 +00:00
|
|
|
# this can be adjusted to be used with self-signed, trusted ca and letsencrypt certs
|
|
|
|
# this example uses letsencrypt certs. replace all occurrences of example.com with your domain
|
2018-06-13 09:22:48 +00:00
|
|
|
# If using LetsEncrypt create letsencrypt certificate by: certbot certonly --webroot -w /var/www/html -d www.example.com
|
2017-01-29 10:01:53 +00:00
|
|
|
# create dhparam.pem by: openssl dhparam -out /etc/nginx/ssl/dhparam.pem 4096
|
2018-06-13 09:22:48 +00:00
|
|
|
# download LetsEncrypt x3 certificate by: wget -q https://letsencrypt.org/certs/lets-encrypt-x3-cross-signed.pem -P /etc/nginx/ssl
|
2017-01-29 10:01:53 +00:00
|
|
|
# you can test your ssl configuration @ https://www.ssllabs.com/ssltest/analyze.html
|
|
|
|
#
|
|
|
|
|
2018-06-13 09:22:48 +00:00
|
|
|
upstream zammad-railsserver {
|
2018-11-21 16:50:05 +00:00
|
|
|
server 127.0.0.1:3000;
|
2017-01-29 10:01:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
upstream zammad-websocket {
|
2018-11-21 16:50:05 +00:00
|
|
|
server 127.0.0.1:6042;
|
2017-01-29 10:01:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
server {
|
2018-06-13 10:07:21 +00:00
|
|
|
listen 80;
|
2017-01-29 10:01:53 +00:00
|
|
|
|
2018-07-18 14:39:11 +00:00
|
|
|
server_name example.com;
|
2017-01-29 10:01:53 +00:00
|
|
|
|
2020-02-11 16:10:43 +00:00
|
|
|
# security - prevent information disclosure about server version
|
|
|
|
server_tokens off;
|
|
|
|
|
2018-06-13 10:07:21 +00:00
|
|
|
access_log /var/log/nginx/zammad.access.log;
|
|
|
|
error_log /var/log/nginx/zammad.error.log;
|
2017-01-29 10:01:53 +00:00
|
|
|
|
2018-06-13 10:07:21 +00:00
|
|
|
location /.well-known/ {
|
|
|
|
root /var/www/html;
|
|
|
|
}
|
2017-01-29 10:01:53 +00:00
|
|
|
|
2019-05-24 09:48:43 +00:00
|
|
|
return 301 https://$server_name$request_uri;
|
2018-10-07 20:34:32 +00:00
|
|
|
|
2017-01-29 10:01:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
server {
|
2018-06-13 10:07:21 +00:00
|
|
|
listen 443 ssl http2;
|
2017-01-29 10:01:53 +00:00
|
|
|
|
2018-06-13 10:07:21 +00:00
|
|
|
server_name example.com;
|
2017-01-29 10:01:53 +00:00
|
|
|
|
2020-02-11 16:10:43 +00:00
|
|
|
# security - prevent information disclosure about server version
|
|
|
|
server_tokens off;
|
|
|
|
|
2018-07-18 14:39:11 +00:00
|
|
|
ssl_certificate /etc/nginx/ssl/example.com-fullchain.pem;
|
|
|
|
ssl_certificate_key /etc/nginx/ssl/example.com-privkey.pem;
|
2017-01-29 10:01:53 +00:00
|
|
|
|
2018-06-13 10:07:21 +00:00
|
|
|
ssl_protocols TLSv1.2;
|
2017-01-29 10:01:53 +00:00
|
|
|
|
2018-06-13 10:07:21 +00:00
|
|
|
ssl_ciphers 'EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH';
|
2017-01-29 10:01:53 +00:00
|
|
|
|
2018-06-13 10:07:21 +00:00
|
|
|
ssl_dhparam /etc/nginx/ssl/dhparam.pem;
|
2017-01-29 10:01:53 +00:00
|
|
|
|
2018-06-13 10:07:21 +00:00
|
|
|
ssl_prefer_server_ciphers on;
|
2017-01-29 10:01:53 +00:00
|
|
|
|
2018-06-13 10:07:21 +00:00
|
|
|
ssl_session_cache shared:SSL:10m;
|
|
|
|
ssl_session_timeout 180m;
|
2017-01-29 10:01:53 +00:00
|
|
|
|
2018-06-13 10:07:21 +00:00
|
|
|
ssl_stapling on;
|
|
|
|
ssl_stapling_verify on;
|
2017-01-29 10:01:53 +00:00
|
|
|
|
2018-07-18 07:43:42 +00:00
|
|
|
ssl_trusted_certificate /etc/nginx/ssl/lets-encrypt-x3-cross-signed.pem;
|
2017-01-29 10:01:53 +00:00
|
|
|
|
2018-06-13 10:07:21 +00:00
|
|
|
resolver 8.8.8.8 8.8.4.4;
|
2017-01-29 10:01:53 +00:00
|
|
|
|
2018-06-13 10:07:21 +00:00
|
|
|
add_header Strict-Transport-Security "max-age=31536000" always;
|
2017-01-29 10:01:53 +00:00
|
|
|
|
2018-07-18 14:39:11 +00:00
|
|
|
location = /robots.txt {
|
|
|
|
access_log off; log_not_found off;
|
|
|
|
}
|
|
|
|
|
|
|
|
location = /favicon.ico {
|
|
|
|
access_log off; log_not_found off;
|
|
|
|
}
|
|
|
|
|
|
|
|
root /opt/zammad/public;
|
|
|
|
|
|
|
|
access_log /var/log/nginx/zammad.access.log;
|
|
|
|
error_log /var/log/nginx/zammad.error.log;
|
|
|
|
|
|
|
|
client_max_body_size 50M;
|
|
|
|
|
|
|
|
location ~ ^/(assets/|robots.txt|humans.txt|favicon.ico) {
|
|
|
|
expires max;
|
|
|
|
}
|
|
|
|
|
|
|
|
location /ws {
|
|
|
|
proxy_http_version 1.1;
|
|
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
|
|
proxy_set_header Connection "Upgrade";
|
|
|
|
proxy_set_header CLIENT_IP $remote_addr;
|
|
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
|
|
proxy_read_timeout 86400;
|
|
|
|
proxy_pass http://zammad-websocket;
|
|
|
|
}
|
|
|
|
|
|
|
|
location / {
|
|
|
|
proxy_set_header Host $http_host;
|
|
|
|
proxy_set_header CLIENT_IP $remote_addr;
|
|
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
|
|
proxy_read_timeout 180;
|
|
|
|
proxy_pass http://zammad-railsserver;
|
2017-01-29 10:01:53 +00:00
|
|
|
|
2018-06-13 10:07:21 +00:00
|
|
|
gzip on;
|
|
|
|
gzip_types text/plain text/xml text/css image/svg+xml application/javascript application/x-javascript application/json application/xml;
|
|
|
|
gzip_proxied any;
|
|
|
|
}
|
2017-01-29 10:01:53 +00:00
|
|
|
}
|