23
submitted 1 year ago* (last edited 1 year ago) by EliteCow@lemmy.dbzer0.com to c/selfhosted@lemmy.world

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.

top 13 comments
sorted by: hot top controversial new old
[-] 0x0@social.rocketsfall.net 11 points 1 year ago

Look into traefik. Once it's set up I add a few labels to my compose files and traefik handles the rest.

[-] bjeanes@lemmy.world 5 points 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 4 points 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 4 points 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 1 points 1 year ago* (last edited 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"
[-] jonno@discuss.tchncs.de 10 points 1 year ago

Take a look at caddy server or the nginx proxy manager and set up a reverse proxy.

[-] EliteCow@lemmy.dbzer0.com 1 points 1 year ago* (last edited 1 year ago)

I ended up setting Caddy. Super easy to add to the Caddyfile (config) and it just works!

I'm going to also look into Traefik as it looks like it has a nice gui.

Thanks a lot!

[-] MoogleMaestro@kbin.social 7 points 1 year ago

My understanding is that you'd need a combination of a reverse proxy and a general proxy manager. Nginx Proxy Manager handles a lot of these tasks for me on my website, with most of my use being a simple redirect though.

[-] ask@kbin.social 5 points 1 year ago

What you need is a reverse proxy server. All the major web servers have this feature.

[-] EliteCow@lemmy.dbzer0.com 4 points 1 year ago

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!

[-] breadsmasher@lemmy.world 4 points 1 year ago* (last edited 1 year ago)
[-] TheInsane42@lemmy.world 3 points 1 year ago* (last edited 1 year ago)

I'm an apache user myself. It's used for static websites as well as other services bia reverse proxying. Letsencrypt for the certs and ssl termination in apache. I'm even considering doing all ipv6 only.

Any webserver or reverse proxy will do though.

[-] netburnr@lemmy.world 2 points 1 year ago

I like virtualmin as a web based solution. Includes proxy options

load more comments
view more: next ›
this post was submitted on 15 Jul 2023
23 points (92.6% liked)

Selfhosted

40135 readers
79 users here now

A place to share alternatives to popular online services that can be self-hosted without giving up privacy or locking you into a service you don't control.

Rules:

  1. Be civil: we're here to support and learn from one another. Insults won't be tolerated. Flame wars are frowned upon.

  2. No spam posting.

  3. Posts have to be centered around self-hosting. There are other communities for discussing hardware or home computing. If it's not obvious why your post topic revolves around selfhosting, please include details to make it clear.

  4. Don't duplicate the full text of your blog or github here. Just post the link for folks to click.

  5. Submission headline should match the article title (don’t cherry-pick information from the title to fit your agenda).

  6. No trolling.

Resources:

Any issues on the community? Report it using the report flag.

Questions? DM the mods!

founded 1 year ago
MODERATORS