nginx/pages.conf

57 lines
1.4 KiB
Text
Raw Normal View History

2022-04-01 13:04:23 +00:00
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name ~^(\d)\.exozy\.me;
include conf.d/ssl;
index index.html;
location / {
# https://serverfault.com/questions/638505/nginx-dynamic-proxy-pass-doesnt-resolve-properly
proxy_pass http://127.0.0.1:420$1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
# Proxy WebSockets
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
2022-04-01 13:04:23 +00:00
}
}
2021-05-22 19:54:16 +00:00
server {
2021-06-17 03:28:04 +00:00
listen 443 ssl http2;
listen [::]:443 ssl http2;
2022-05-16 21:40:43 +00:00
server_name ~^(?<page>.+)\.exozy\.me;
2021-05-22 19:54:16 +00:00
include conf.d/ssl;
2021-05-25 03:24:31 +00:00
2022-05-16 21:40:43 +00:00
root /srv/http/pages/$page;
2021-05-25 03:24:31 +00:00
index index.html;
2021-08-02 15:05:27 +00:00
2022-05-17 17:58:08 +00:00
error_page 502 404 /404.html;
location = /404.html {
internal;
}
2021-05-25 03:24:31 +00:00
location / {
2022-05-16 21:40:43 +00:00
try_files $uri $uri.html $uri/ = @fallback;
}
location @fallback {
2022-05-21 16:57:02 +00:00
proxy_pass http://unix:/srv/http/pages/$page;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
# Proxy WebSockets
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
2021-05-25 03:24:31 +00:00
}
2021-05-22 19:54:16 +00:00
}