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

  • frongt@lemmy.zip
    link
    fedilink
    English
    arrow-up
    18
    arrow-down
    4
    ·
    3 months ago

    I am once again recommending that you not expose any services to the internet except a VPN

    • Estebiu@lemmy.dbzer0.com
      link
      fedilink
      English
      arrow-up
      4
      ·
      3 months ago

      It works well, but if you want to do ‘custom stuff’ (like hosting a matrix instance) you’ll be out of luck

    • Aneb@lemmy.world
      link
      fedilink
      English
      arrow-up
      3
      ·
      3 months ago

      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

  • ragica@lemmy.ml
    link
    fedilink
    English
    arrow-up
    6
    ·
    3 months ago

    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.)

  • LievitoPadre@feddit.it
    link
    fedilink
    English
    arrow-up
    4
    ·
    3 months ago

    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

  • Mike Wooskey@lemmy.thewooskeys.com
    link
    fedilink
    English
    arrow-up
    2
    ·
    3 months ago

    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.

  • BonkTheAnnoyed@lemmy.blahaj.zone
    link
    fedilink
    English
    arrow-up
    2
    arrow-down
    1
    ·
    3 months ago

    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.

  • pathos@lemmy.ml
    link
    fedilink
    English
    arrow-up
    1
    ·
    3 months ago

    Oh I thought it was sub domains for localhost. I actually wonder now if that’s possible.