From 4b2d60bfaff0e829857f6c74c1021ab101e50598 Mon Sep 17 00:00:00 2001 From: rav4s Date: Mon, 28 Dec 2020 15:34:47 -0600 Subject: [PATCH] Added example config for a subdomain other than www --- subdomain-proxy.conf | 56 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 subdomain-proxy.conf diff --git a/subdomain-proxy.conf b/subdomain-proxy.conf new file mode 100644 index 0000000..b8c8486 --- /dev/null +++ b/subdomain-proxy.conf @@ -0,0 +1,56 @@ +# Example configuration for another subdomain + +# Redirect http traffic to https + +server { + listen 80; + server_name YOURSUBDOMAIN.YOURSITEDOMAIN.com; + return 301 https://$host$request_uri; +} + +# Main https server block + +server { + + listen 443; + server_name YOURSUBDOMAIN.YOURSITEDOMAIN.com; + + # SSL configuration + + ssl_certificate /etc/letsencrypt/live/YOURSUBDOMAIN.YOURSITEDOMAIN.com/fullchain.pem; # managed by Certbot + ssl_certificate_key /etc/letsencrypt/live/YOURSUBDOMAIN.YOURSITEDOMAIN.com/privkey.pem; # managed by Certbot + ssl on; + ssl_session_cache builtin:1000 shared:SSL:10m; + ssl_protocols TLSv1 TLSv1.1 TLSv1.2; + ssl_ciphers HIGH:!aNULL:!eNULL:!EXPORT:!CAMELLIA:!DES:!MD5:!PSK:!RC4; + ssl_prefer_server_ciphers on; + + # Set the access log location + + access_log /var/log/nginx/YOURSUBDOMAIN.access.log; + + location / { + + # Set the proxy headers + + 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; + + # Configure which address the request is proxied to + + proxy_pass http://YOURSERVER:YOURPORT; + proxy_read_timeout 90; + proxy_redirect http://YOURSERVER:YOURPORT https://YOURSUBDOMAIN.YOURSITEDOMAIN.com; + + # Set the security headers + + add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload"; + add_header X-Frame-Options DENY; + add_header X-Content-Type-Options nosniff; + add_header X-XSS-Protection "1; mode=block"; + add_header Referrer-Policy "origin"; + } + +}