forked from exozyme/nginx
Anthony Wang
f9748b3ec7
The first change doesn't require any manual intervention since /srv/http/pages is now symlinked to /srv/http. The purpose of it is just to make paths shorter, that's all. I have several reasons for the second change, even though it may have been a useful feature: - Security: Some programs use those ports by default and you don't want to accidentally expose them to the internet. If you want to run a program on exozyme and view it on your own computer, use SSH port forwarding instead. - There was some weird DNS resolution problem with that config so I made it only listen to IPv4, which can cause problems since some programs only bind to IPv6. - If you want to expose a program to the internet, you must use a Unix socket or socat. This feature was useful as a quick-and-dirty option, but socat is also just one command and doesn't require much more effort.
31 lines
751 B
Text
31 lines
751 B
Text
server {
|
|
listen 443 ssl;
|
|
listen [::]:443 ssl;
|
|
server_name ~^(?<page>.+)\.exozy\.me;
|
|
|
|
root /srv/http/$page;
|
|
index index.html;
|
|
|
|
error_page 502 404 /404.html;
|
|
location = /404.html {
|
|
internal;
|
|
}
|
|
|
|
location / {
|
|
try_files $uri $uri.html $uri/ = @fallback;
|
|
}
|
|
|
|
location @fallback {
|
|
proxy_pass http://unix:/srv/http/$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";
|
|
}
|
|
}
|