Added nginx config

This commit is contained in:
Rob Kelly 2024-12-03 18:23:30 -07:00
parent 424daf2baf
commit 80ec8573a5
1 changed files with 48 additions and 0 deletions

48
nginx/intrusive Normal file
View File

@ -0,0 +1,48 @@
# nginx configuration for intrusive.games
server {
root /var/www/intrusive;
index index.html index.htm;
server_name intrusive.games www.intrusive.games;
# Should have been added by certbot but wasnt?
listen 443 ssl;
ssl_certificate /etc/letsencrypt/live/intrusive.games/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/intrusive.games/privkey.pem;
include /etc/letsencrypt/options-ssl-nginx.conf;
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
# Add 1 day expires header for static assets
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
expires 1d;
}
location / {
# First attempt to serve request as file, then
# as directory, then fall back to redirecting to index.html
try_files $uri $uri/ @root;
}
# If nginx can't find a file, fallback to the homepage.
location @root {
rewrite .* / redirect;
}
}
server {
if ($host = intrusive.games) {
return 301 https://$host$request_uri;
}
server_name intrusive.games www.intrusive.games;
listen 80;
return 404;
}
server {
server_name discord.intrusive.games;
listen 80;
return 301 https://discord.gg/9ArMrDDUgA;
}