Skip to content

Instantly share code, notes, and snippets.

@Soulsender
Created August 2, 2024 21:27
Show Gist options
  • Save Soulsender/34783750b97ade0f760d431048cdd7f3 to your computer and use it in GitHub Desktop.
Save Soulsender/34783750b97ade0f760d431048cdd7f3 to your computer and use it in GitHub Desktop.
server {
# define domain name to use, in my case it's a subdomain
server_name server.soulsender.me;
# this is the root of server.soulsender.me
location / {
# this is the path of your media files
root /hosting;
autoindex on;
}
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/server.soulsender.me/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/server.soulsender.me/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
}
# redirects HTTP to HTTPS
server {
if ($host = server.soulsender.me) {
return 301 https://$host$request_uri;
} # managed by Certbot
server_name server.soulsender.me;
listen 80;
return 404; # managed by Certbot
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment