I have a bunch of services running on my LAN, mostly from a single Debian machine. I access them at URLs like http://devicename.lan:portnumber. I would like to change to http://servicename.devicename.lan.

How it works now: The router (openwrt) sets a static IP per device and the port number is selected by the application or system unit running it.

What is the absolute simplest way to accomplish this? I don’t mind if it is managed by the router or by the server machine itself. Hoping for something that can be configured with a text file or web interface or other basic mathod.

These sevices are private, just for me and I have no plans to ever access them externally. I have so far avoided any certificates or SSL or other stuff. I don’t use docker and would rather not get into it right now. I like my domain name setup how it is with fake local domains.

Hoping this could be possible without making a whole project out of it.

  • un_ax@lemmy.today
    link
    fedilink
    English
    arrow-up
    3
    ·
    19 hours ago

    If they’re just internal the simplest way is to add another IP on the same interface to whatever is serving your service, then bind the service to that IP and add the entry in DNS.

    If for some reason you want to keep everything hosted on one IP, for a reverse proxy, caddy is pretty simple. An example caddyfile would be:

    
    http://service1.devicename.lan/ { 
        reverse_proxy 1.2.3.4:9005
    }
    
    http://service2.devicename.lan/ { 
        reverse_proxy 127.0.0.1:1234
    }
    

    This would also allow you to set https in the future using ACME (dns method if internal only) or your own CA / custom cert.

    • layzerjeyt@lemmy.dbzer0.comOP
      link
      fedilink
      English
      arrow-up
      1
      ·
      18 hours ago

      I don’t really like the idea of having a separate IP for every service. It would need to be configured in the service itself (assuming that is possible for all of them, I don’t know), on the router, and by whatever means you create IPs. Too complex.

      A lot of people are recommending caddy.

      All my web services use apache or lighttd. Do I use caddy just for this or do I have to figure out how to move each of them to use this web server?

      Also does it work for non-web services, like ssh or samba? (Which wasn’t in my original question, I only thought of it now.)

      • Possibly linux@lemmy.zip
        link
        fedilink
        English
        arrow-up
        2
        ·
        16 hours ago

        I would look into learning about the OSI model

        For context, Caddy is a reverse proxy which is specific to the layer 7 protocol http. Layer 7 protocols are generally not compatible with one another since under the hood SSH, HTTP are all very different despite them all running on top of TCP.