From 07a1d9857546c353987a93cf903446d74b858093 Mon Sep 17 00:00:00 2001 From: Caretaker0699 Date: Thu, 15 Aug 2024 19:54:34 +0000 Subject: [PATCH] add nginx default template --- nginx-template | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 nginx-template diff --git a/nginx-template b/nginx-template new file mode 100644 index 000000000..ac56a9a5b --- /dev/null +++ b/nginx-template @@ -0,0 +1,47 @@ +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 + + + + +}