-
Notifications
You must be signed in to change notification settings - Fork 114
Complete Nginx Configuration for docker mailman
Abhilash Raj edited this page Jan 11, 2021
·
2 revisions
Complete Nginx configuration for docker-mailman including SSL setup.
First, you need to install Nginx and certbot (to setl Let's encrypt certificate) using your package manager. For Ubuntu/Debian systems run:
$ sudo apt install nginx certbot certbot-nginx
To setup TLS certificates first, you can run:
$ sudo certbot --nginx
# Follow the prompts from this command and requires the port 443 to be allowed in your firewall.
You can refer to the official documentation of certbot for more details or any issues you might have. Do note that official documentation suggest using snaps for installing while I prefer using simple apt packages instead.
Replace mailman.araj.me with your domain.
server {
# SSL configuration
#
# listen 443 ssl default_server;
# listen [::]:443 ssl default_server;
#
# Note: You should disable gzip for SSL traffic.
# See: https://bugs.debian.org/773332
#
# Read up on ssl_ciphers to ensure a secure configuration.
# See: https://bugs.debian.org/765782
#
# Self signed certs generated by the ssl-cert package
# Don't use them in a production server!
#
# include snippets/snakeoil.conf;
# root /var/www/html;
# Add index.php to the list if you are using PHP
index index.html index.htm index.nginx-debian.html;
server_name mailman.araj.me; # managed by Certbot
location /static {
alias /opt/mailman/web/static;
autoindex off;
}
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
uwsgi_pass 172.19.199.3:8080;
include uwsgi_params;
uwsgi_read_timeout 300;
}
listen [::]:443 ssl ipv6only=on; # managed by Certbot
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/mailman.araj.me/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/mailman.araj.me/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
Wiki for Container Images for Mailman.