2021-10-08 12:39:31 +00:00
|
|
|
# SPDX-FileCopyrightText: 2021 The NGI Pointer Secure-Scuttlebutt Team of 2020/2021
|
|
|
|
#
|
|
|
|
# SPDX-License-Identifier: Unlicense
|
|
|
|
|
2021-04-19 15:10:46 +00:00
|
|
|
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;
|
2022-04-06 00:12:33 +00:00
|
|
|
# requires a $connection_upgrade definition in /etc/nginx/nginx.conf
|
|
|
|
# see https://futurestud.io/tutorials/nginx-how-to-fix-unknown-connection_upgrade-variable
|
2021-04-19 15:10:46 +00:00
|
|
|
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;
|
2021-04-21 15:27:35 +00:00
|
|
|
# "rewrite" requests with subdomains to the non-wildcard url for alias resolving
|
|
|
|
# $is_args$args pass on ?encoding=json if present
|
|
|
|
proxy_pass http://localhost:8899/alias/$alias$is_args$args;
|
2021-04-19 15:10:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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
|
2021-10-08 12:39:31 +00:00
|
|
|
}
|