• 0 Posts
  • 4 Comments
Joined 1 year ago
cake
Cake day: June 6th, 2023

help-circle



  • Please correct me if I’m wrong, but here’s what I think the situation is:

    • you have two different sevices that you have domains for, e.g. lemmy and bitwarden.
    • you have two domains, lets call them lemmy.com and bitwarden.com .
    • you have one (public?) IP address. let’s call that 123.123.123.123 .
    • you want to use this IP address for both domains (e.g. bitwarden.alpha.com and lemmy.beta.com)

    In that case you need both domains to connect to the same computer (because that’s the one with that IP address) which routes it to the correct location (either on the same computer or on a different one).

    You basically have two solutions (that you already mentioned)

    1. single machine

    • You run both services on a single machine, listening on different ports on localhost/127.0.0.1 .
      • lemmy listens on port 1234 and bitwarden on port 8080.
    • You use nginx (or caddy/apache) to listen on the web ports (80, 443) and reverse proxy(!) the content.
      • if the domain is lemmy.com it proxies from localhost:1234
      • if the domain is bitwarden.com it proxies from localhost:8080 This is the easiest solution IMO.

    2. different machines.

    This is essentially the same, but instead of the services running locally, one or both run on different machines.

    • you run both services on different machines
      • lemmy on 10.0.0.10:1234
      • bitwarden on 10.0.0.20:8080
    • You use nginx again as reverse-proxy(!):
      • if the domain is lemmy.com it proxies from 10.0.0.10:1234
      • if the domain is bitwarden.com it proxies from 10.0.0.20:8080
    • be sure to check the firewall settings of the machines, that allow it.

    In both cases the IP address points to the machine running nginx.

    If you can run both services on the same machine with docker, you should just use this: https://github.com/nginx-proxy/nginx-proxy