Edit

Damn, Lemmy is so awesome!

Thanks so much everybody for the quick amazing replies! I will look into the suggested reverse proxy options and get something set up.

Thanks again for all of the insight!

End edit

Let’s say I have multiple services and applications running on my server.

In this case, I’m using docker and have layer 2 docker network to give each container a dedicated IP.

Internally, I can navigate to the local IP to utilize or access them.

How would I go about accessing each service through the internet using different subdomains? Right now all subdomains and the primary domain route directly to my external IP and seem to all resolve to the same service /application.

I imagine this would have to be done with some sort of routing rules but would love some insight! I have a UniFi Dream Router.

    • bjeanes@lemmy.world
      link
      fedilink
      English
      arrow-up
      1
      ·
      1 year ago

      My thoughts also. Traefik docs can be a bit confusing if you’re coming to it with no context, though, but it’s definitely the ideal option for just routing to a bunch of docker containers!

    • passepartout@feddit.de
      link
      fedilink
      English
      arrow-up
      1
      ·
      1 year ago

      Im using traefik as reverse proxy for everything, docker container or not.

      Bonus: If you own a domain name, you can get https certificates without opening http ports to the outside via dns challenges. You can even get certs for wildcard domains like *.example.com

      • theRealBassist@lemmy.world
        link
        fedilink
        English
        arrow-up
        1
        ·
        1 year ago

        Do you know of a good reference for using Traefik with non-docker uses? I’ve struggled to figure that one out lol

        • passepartout@feddit.de
          link
          fedilink
          English
          arrow-up
          1
          ·
          edit-2
          1 year ago

          What you need is a so called File Provider. The linked blog post seems to summarize this pretty good, at least better than the original docs.

          You define your path as a “router” and the ip traefik should point to as “service”. Optionally, you can define all kinds of “middlewares”. Example:

          # As YAML Configuration File
          http:
            routers:
              router1:
                service: myService      <-- Edit: this should be service1, so it uses your defined service below
                middlewares:
                  - "foo-add-prefix"
                rule: "Host(`example.com`)"
          
            middlewares:
              foo-add-prefix:
                addPrefix:
                  prefix: "/foo"
          
            services:
              service1:
                loadBalancer:
                  servers:
                    - url: "http://127.0.0.1:80"