I created a short tutorial on using sub domains to access services hosted within my home network, thought I would share it here in case anyone finds it useful
This is the first time I’ve made a technical tutorial so apologise if there are mistakes/its confusing, feedback will be appreciated
I am once again recommending that you not expose any services to the internet except a VPN
Thanks for sharing!
I can recommend nginx-proxy-manager for people who do not want to fiddle with proxy config files.
It works well, but if you want to do ‘custom stuff’ (like hosting a matrix instance) you’ll be out of luck
I personally use caddy as a reverse proxy
Yeah it was honestly changing the router settings that was the hardest part for me, exposing port 22 and 80. Caddy was really easy to use
You seem to have descibed your port forwards backwards It is the router forwarding the ports to the gateway pi (and potentially other devices), not gateway pi and other devices forwarding to the router. The forwards to servers are incoming from the internet.
(Theoretically you could have your pi physically between the router and the internet (modem) acting as a sort of pre-router, but this would be unusual. Perhaps you could describe your physical setup more clearly. What is physically/wirelessly connected to what, to the internet.)
I did similar with caddy. I own a domain and my server runs pihole and it is configured as DNS server. So what I did was setup caddy to create local subdomains that are only reachable through my network. For example: subdomain.mydomain.com , that works only from home. It works with ssl as well
I use caddy as well, but with headscale too so I can access it from wherever I am.
Not positive, but I think you left in a reference to real info (twilightparadox.com) instead of “example-fying” it (mydomain.com), in the paragraph just before section 4:
For example say I have home-assistant running on a Pi with the local address 192.168.0.11, I could create a subdomain named ha that has the value mysub.twilightparadox.com then create the following nginx config
server{ listen 80; server_name ha.mydomain.com; resolver 192.168.0.1; location / { proxy_pass http://192.168.0.11/; } }When nginx sees a request for ha.mydomain.com it passes it to the address 192.168.0.11 port 80.
I’m not sure which reference you are referring to, twilightparadox.com is a domain on the dynamic DNS service, mysub is also an example
Very cool, great work!
Worth noting about this approach is that the global list of subdomains is publicly searchable. So, you’ll see vulnerability and AI scans on those endpoints.
If that’s a concern for you, using path-based routing (e.g. Apache VirtualHost) allows you to use difficult to guess paths to your cloud.
Oh I thought it was sub domains for localhost. I actually wonder now if that’s possible.
nice job





