Change /srv/http/pages to /srv/http, don't automatically forward ports 4200-9

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.
This commit is contained in:
Anthony Wang 2024-01-20 15:56:03 +00:00
parent 25b463ada1
commit f9748b3ec7
Signed by: a
SSH key fingerprint: SHA256:B5ADfMCqd2M7d/jtXDoihAV/yfXOAbWWri9+GdCN4hQ
8 changed files with 10 additions and 32 deletions

View file

@ -4,7 +4,7 @@ server {
server_name library.exozy.me;
location / {
proxy_pass http://unix:/srv/http/pages/library;
proxy_pass http://unix:/srv/http/library;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

View file

@ -12,7 +12,7 @@ server {
listen [::]:443 ssl default_server;
server_name exozy.me;
root /srv/http/exozyme;
root /srv/http/www;
index index.html;
location /.well-known/matrix/server {

View file

@ -7,7 +7,7 @@ server {
ssl_certificate_key /etc/letsencrypt/live/www2.1a-insec.net/privkey.pem;
location / {
proxy_pass http://unix:/srv/http/pages/xrablnhmov;
proxy_pass http://unix:/srv/http/xrablnhmov;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

View file

@ -7,7 +7,7 @@ server {
ssl_certificate_key /etc/letsencrypt/live/neovoid.is-cool.dev/privkey.pem;
location / {
proxy_pass http://unix:/srv/http/pages/nvpie;
proxy_pass http://unix:/srv/http/nvpie;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

View file

@ -1,31 +1,9 @@
server {
listen 443 ssl;
listen [::]:443 ssl;
server_name ~^(\d)\.exozy\.me;
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";
}
}
server {
listen 443 ssl;
listen [::]:443 ssl;
server_name ~^(?<page>.+)\.exozy\.me;
root /srv/http/pages/$page;
root /srv/http/$page;
index index.html;
error_page 502 404 /404.html;
@ -38,7 +16,7 @@ server {
}
location @fallback {
proxy_pass http://unix:/srv/http/pages/$page;
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;

View file

@ -7,7 +7,7 @@ server {
ssl_certificate_key /home/pranav/.local/share/cert/karawale.in/key.pem;
location / {
proxy_pass http://unix:/srv/http/pages/pranav;
proxy_pass http://unix:/srv/http/pranav;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

View file

@ -3,7 +3,7 @@ server {
listen [::]:443 ssl;
server_name safetwitch.exozy.me;
root /srv/http/pages/safetwitch;
root /srv/http/safetwitch;
index index.html;
location / {

View file

@ -9,7 +9,7 @@ server {
add_header Server exozyme;
location / {
proxy_pass http://unix:/srv/http/pages/xtexhome;
proxy_pass http://unix:/srv/http/xtexhome;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
@ -33,7 +33,7 @@ server {
add_header Server exozyme;
location / {
proxy_pass http://unix:/srv/http/pages/xtexblog;
proxy_pass http://unix:/srv/http/xtexblog;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;