## # You should look at the following URL's in order to grasp a solid understanding # of Nginx configuration files in order to fully unleash the power of Nginx. # http://wiki.nginx.org/Pitfalls # http://wiki.nginx.org/QuickStart # http://wiki.nginx.org/Configuration # # Generally, you will want to move this file somewhere, and start with a clean # file but keep this around for reference. Or just disable in sites-enabled. # # Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples. ## # Default server configuration # upstream mailpile { server mailpile-service-dockerbunker:${PORT}; } server { listen 80; server_name ${SERVICE_DOMAIN}; return 301 https://$host$request_uri; } server { listen 443; server_name ${SERVICE_DOMAIN}; ssl on; ssl_certificate /etc/nginx/ssl/${SERVICE_DOMAIN}/cert.pem; ssl_certificate_key /etc/nginx/ssl/${SERVICE_DOMAIN}/key.pem; include /etc/nginx/includes/ssl.conf; add_header Strict-Transport-Security "max-age=15768000; includeSubDomains"; add_header X-Frame-Options SAMEORIGIN; add_header X-Content-Type-Options nosniff; include /etc/nginx/includes/gzip.conf; location ${LOCATION} { rewrite ^(.*)$ $1 break; # prevents additional rewrites of the path via proxy_pass proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_set_header X-NginX-Proxy true; proxy_pass http://mailpile/; } location ~ /.well-known { allow all; root /var/www/html; } }