shoebottom.ca-nginx/homepage.conf

119 lines
3.3 KiB
Plaintext
Raw Normal View History

2022-10-07 00:40:05 -03:00
server {
# Server name, root and index
2022-10-07 00:40:05 -03:00
server_name shoebottom.ca; # managed by Certbot
root /home/isaac/www/shoebottom.ca;
index index.html;
# Listen on https
listen [::]:443 ssl http2 ipv6only=on default_server; # managed by Certbot
listen 443 ssl http2 default_server; # managed by Certbot
# Listen for matrix port
listen 8448 ssl http2;
listen [::]:8448 ssl http2;
# SSL configuration
2022-10-07 00:40:05 -03:00
ssl_certificate /etc/letsencrypt/live/shoebottom.ca/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/shoebottom.ca/privkey.pem; # managed by Certbot
ssl_trusted_certificate /etc/letsencrypt/live/shoebottom.ca/chain.pem; # managed by Certbot
2022-10-07 00:40:05 -03:00
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
ssl_stapling on; # managed by Certbot
ssl_stapling_verify on; # managed by Certbot
2022-10-07 00:40:05 -03:00
# Security / HSTS Headers
2022-10-07 00:40:05 -03:00
add_header Strict-Transport-Security "max-age=31536000" always; # managed by Certbot
# Security / XSS Mitigation Headers
add_header X-Frame-Options "SAMEORIGIN";
add_header X-XSS-Protection "1";
add_header X-Content-Type-Options "nosniff";
# Disabled header for content security policy, because I want to load images and content from other sites
2022-10-07 00:40:05 -03:00
# add_header Content-Security-Policy "default-src 'self' https://i.imgur.com;" always;
# Disable merge slashes, non-standard and needed for matrix
merge_slashes off;
# Nginx defaults to only allow 1MB uploads
client_max_body_size 20M;
# Matrix subdirectory
location /_matrix/ {
proxy_pass http://127.0.0.1:6167$request_uri;
proxy_set_header Host $http_host;
proxy_buffering off;
}
2023-05-07 17:51:26 -03:00
# Low Quality Music subdirectory
location /music-lq {
autoindex on;
2023-05-07 18:01:14 -03:00
autoindex_exact_size off;
2023-05-07 17:51:26 -03:00
sendfile on;
alias /home/isaac/Media/Music-LQ;
}
# Music subdirectory
2022-10-07 00:40:05 -03:00
location /music {
autoindex on;
2023-05-07 18:01:14 -03:00
autoindex_exact_size off;
2022-10-07 00:40:05 -03:00
sendfile on;
alias /home/isaac/Media/Music;
}
2023-05-07 17:51:26 -03:00
# High Quality Music subdirectory
location /music-hq {
autoindex on;
2023-05-07 18:01:14 -03:00
autoindex_exact_size off;
2023-05-07 17:51:26 -03:00
sendfile on;
alias /home/isaac/Media/Music-HQ;
}
# Movies subdirectory
2022-10-07 00:40:05 -03:00
location /movies {
autoindex on;
2023-05-07 18:01:14 -03:00
autoindex_exact_size off;
2022-10-07 00:40:05 -03:00
sendfile on;
alias /home/isaac/Media/Movies;
}
# TV subdirectory
2022-10-07 00:40:05 -03:00
location /tv {
autoindex on;
2023-05-07 18:01:14 -03:00
autoindex_exact_size off;
2022-10-07 00:40:05 -03:00
sendfile on;
alias /home/isaac/Media/TV;
}
# Anime subdirectory
2022-10-07 00:40:05 -03:00
location /anime {
autoindex on;
2023-05-07 18:01:14 -03:00
autoindex_exact_size off;
2022-10-07 00:40:05 -03:00
sendfile on;
alias /home/isaac/Media/Anime;
}
# File hosting subdirectory
2022-10-07 00:40:05 -03:00
location /host {
autoindex off;
sendfile on;
alias /home/isaac/Media/Host;
}
}
server {
# Redirect http to https
2022-10-07 00:40:05 -03:00
if ($host = shoebottom.ca) {
return 301 https://$host$request_uri;
} # managed by Certbot
# Listen on http, no ssl. Needed for certbot
2022-10-07 00:40:05 -03:00
listen 80 default_server;
listen [::]:80 default_server;
server_name shoebottom.ca; # managed by Certbot
root /home/isaac/www/shoebottom.ca;
index index.html;
}