githaven-fork/nginx-template

48 lines
1.6 KiB
Plaintext
Raw Permalink Normal View History

2024-08-15 19:54:34 +00:00
server {
server_name your-website.org www.your-website.org;
add_header Strict-Transport-Security max-age=31536000;
add_header X-Content-Type-Options nosniff;
add_header X-Frame-Options "SAMEORIGIN";
add_header X-XSS-Protection "1; mode=block";
add_header Content-Security-Policy "default-src 'self' data:; script-src 'self' 'unsafe-inline' data:; font-src 'self' data:; manifest-src 'self' data:; style-src 'self' 'unsafe-inline' data:; img-src 'self' data: https://secure.gravatar.com";
client_max_body_size 500m;
location / {
proxy_pass http://localhost:3000;
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_read_timeout 86400;
}
listen 443 http2 ssl;
listen [::]:443 http2 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/YOURWEBSITE/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/YOURWEBSITE/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
}
server {
if ($host = www.your-website.org) {
return 301 https://$host$request_uri;
} # managed by Certbot
if ($host = your-website.org) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80;
listen [::]:80;
server_name your-website.org www.your-website.org;
return 404; # managed by Certbot
}