67 lines
2.4 KiB
Plaintext
67 lines
2.4 KiB
Plaintext
|
server {
|
||
|
server_name hermies.club;
|
||
|
|
||
|
listen 443 ssl; # managed by Certbot
|
||
|
|
||
|
ssl_certificate /etc/letsencrypt/live/hermies.club/fullchain.pem; # managed by Certbot
|
||
|
ssl_certificate_key /etc/letsencrypt/live/hermies.club/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
|
||
|
|
||
|
location / {
|
||
|
proxy_pass http://localhost:8899;
|
||
|
proxy_set_header Host $host;
|
||
|
proxy_set_header X-Forwarded-Host $host;
|
||
|
proxy_set_header X-Forwarded-For $remote_addr:$remote_port;
|
||
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||
|
# for websocket
|
||
|
proxy_http_version 1.1;
|
||
|
proxy_set_header Upgrade $http_upgrade;
|
||
|
proxy_set_header Connection $connection_upgrade;
|
||
|
}
|
||
|
|
||
|
# TODO: https://blog.tarq.io/nginx-catch-all-error-pages/
|
||
|
}
|
||
|
|
||
|
# this server uses the (same) wildcard cert as the one above but uses a regular expression on the hostname
|
||
|
# which extracts the first subdomain which holds the alias and forwards that to the prox_pass server
|
||
|
server {
|
||
|
server_name "~^(?<alias>\w+)\.hermies\.club$";
|
||
|
|
||
|
listen 443 ssl; # managed by Certbot
|
||
|
|
||
|
ssl_certificate /etc/letsencrypt/live/hermies.club/fullchain.pem; # managed by Certbot
|
||
|
ssl_certificate_key /etc/letsencrypt/live/hermies.club/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
|
||
|
|
||
|
location = / {
|
||
|
proxy_set_header Host $host;
|
||
|
proxy_set_header X-Forwarded-Host $host;
|
||
|
proxy_set_header X-Forwarded-For $remote_addr:$remote_port;
|
||
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||
|
proxy_pass http://localhost:8899/alias/$alias;
|
||
|
}
|
||
|
|
||
|
location / {
|
||
|
proxy_set_header Host $host;
|
||
|
proxy_set_header X-Forwarded-Host $host;
|
||
|
proxy_set_header X-Forwarded-For $remote_addr:$remote_port;
|
||
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||
|
proxy_pass http://localhost:8899;
|
||
|
}
|
||
|
|
||
|
# TODO: https://blog.tarq.io/nginx-catch-all-error-pages/
|
||
|
}
|
||
|
|
||
|
server {
|
||
|
if ($host ~ hermies.club$ ) {
|
||
|
return 301 https://$host$request_uri;
|
||
|
} # managed by Certbot
|
||
|
|
||
|
|
||
|
listen 80 default_server;
|
||
|
listen [::]:80 default_server;
|
||
|
server_name hermies.club;
|
||
|
return 404; # managed by Certbot
|
||
|
}
|