In order to expose notymail to the web securely, it is recommended to proxy it behind a traditional webserver such as nginx or Apache.
Below are some example configurations that you could use.
Nginx (With SSL)
# Remove '#' in the next line to enable IPv6
# listen [::]:443 ssl http2;
server_name notymail.your_domain.your_tld;
ssl_certificate /path/to/ssl/cert/crt;
ssl_certificate_key /path/to/ssl/key/key;
# *See "With SSL (Certbot)" below for details on automating ssl certificates
proxy_set_header X-Real-IP $ remote_addr ;
proxy_set_header X-Forwarded-For $ proxy_add_x_forwarded_for ;
proxy_set_header Host $ host ;
proxy_pass http://localhost:3124/;
proxy_set_header Upgrade $ http_upgrade ;
proxy_set_header Connection "upgrade" ;
Nginx (Without SSL)
# Remove '#' in the next line to enable IPv6
server_name notymail.your_domain.your_tld;
proxy_pass http://localhost:3124;
proxy_set_header Upgrade $ http_upgrade ;
proxy_set_header Connection "upgrade" ;
proxy_set_header Host $ host ;
Nginx (With SSL Certbot)
# If you don't have one yet, you can set up a subdomain with your domain registrar (e.g. Namecheap)
# Just create a new host record with type='A Record', host='<subdomain>', value='<ip_address>'.
server_name notymail.your_domain.your_tld;
proxy_set_header X-Real-IP $ remote_addr ;
proxy_set_header X-Forwarded-For $ proxy_add_x_forwarded_for ;
proxy_set_header Host $ host ;
proxy_pass http://localhost:3124/;
proxy_set_header Upgrade $ http_upgrade ;
proxy_set_header Connection "upgrade" ;
# Once that's completed, you can run
# sudo apt install python3-certbot-nginx
# sudo certbot --nginx -d your_domain -d notymail.your_domain.your_tld
# And Certbot will auto-populate this nginx .conf file for you, while also renewing your certificates automatically in the future.
Apache
With SSL:
ServerName notymail.your_domain.your_tld
SSLCertificateFile /path/to/ssl/cert/crt
SSLCertificateKeyFile /path/to/ssl/key/key
# Protocol 'h2' is only supported on Apache 2.4.17 or newer.
ProxyPass / http://localhost: 3124 /
RewriteCond %{HTTP:Upgrade} =websocket
RewriteRule /(.*) ws://localhost:3124/$1 [P,L]
RewriteCond %{HTTP:Upgrade} !=websocket
RewriteRule /(.*) http://localhost:3124/$1 [P,L]
Without SSL:
ServerName notymail.your_domain.your_tld
ProxyPass / http://localhost: 3124 /
RewriteCond %{HTTP:Upgrade} websocket [NC]
RewriteCond %{HTTP:Connection} upgrade [NC]
RewriteRule ^/?(.*) "ws://localhost:3124/$1" [P,L]
Caddy
notymail.your_domain. your_tld {
reverse_proxy 127.0.0.1:3124
Caddy with Docker-compose
If you run notymail using Docker-Compose and don’t already have a reverse proxy, this is a simple way to configure Caddy.
# HERE BELONGS THE docker-compose.yml snippet
caddy : notymail.your_domain.your_tld
caddy.reverse_proxy : ' * {{upstreams 3124}} '
image : ' lucaslorentz/caddy-docker-proxy:ci-alpine '
- /var/run/docker.sock:/var/run/docker.sock:ro
- CADDY_INGRESS_NETWORKS=proxy_network
Replace notymail.your_domain.your_tld
with your domain.
Https-Portal
Example docker-compose.yml file using Https-Portal:
image : steveltn/https-portal:1
DOMAINS : ' notymail.your_domain.your_tld -> http://notymail:3124 '
- https-portal-data:/var/lib/https-portal
# HERE BELONGS THE docker-compose.yml snippet
Replace notymail.your_domain.your_tld
with your domain
Traefik
- ' traefik.http.routers.notymail.rule=Host(`YourOwnHostname`) '
- ' traefik.http.routers.notymail.entrypoints=https '
- ' traefik.http.routers.notymail.tls=true '
- ' traefik.http.routers.notymail.tls.certresolver=myresolver '
- ' traefik.http.services.notymail.loadBalancer.server.port=3124 '
Replace notymail.your_domain.your_tld
with your domain
When setup correctly, Traefik can automatically get a Let’s Encrypt certificate for your service.