Skip to content

Instantly share code, notes, and snippets.

@h3artbl33d
Last active June 17, 2019 20:03
Show Gist options
  • Save h3artbl33d/e43f087665f6eeb12f3871e6c39e12b1 to your computer and use it in GitHub Desktop.
Save h3artbl33d/e43f087665f6eeb12f3871e6c39e12b1 to your computer and use it in GitHub Desktop.
nginx configuration for Mailpile
server {
listen 443 ssl http2;
listen [::]443 ssl http2;
server_name sub.yourdomain.com;
ssl_certificate /etc/ssl/sub.yourdomain.cer;
ssl_certificate_key /etc/ssl/private/sub.yourdomain.key;
# TLS protocol and ciphers
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers "ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-CHACHA20-POLY1305:AES-256-GCM-SHA384:EECDH+AESGCM:EDH+AESGCM";
ssl_ecdh_curve secp384r1;
ssl_dhparam /etc/ssl/dhparam.pem; # openssl dhparam -out /etc/ssl/dhparam.pem 4096
ssl_prefer_server_ciphers on;
# TLS session
ssl_session_timeout 5m;
ssl_session_cache shared:SSL:1m;
ssl_session_tickets off;
# Security headers
add_header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload" always;
add_header X-Xss-Protection "1; mode=block" always;
add_header Referrer-Policy "no-referrer-when-downgrade" always;
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-Content-Type-Options "nosniff" always;
location / {
client_max_body_size 50M;
proxy_set_header Connection "";
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Frame-Options SAMEORIGIN;
proxy_buffers 256 16k;
proxy_buffer_size 16k;
proxy_read_timeout 600s;
proxy_http_version 1.1;
proxy_pass http://localhost:33411;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment