Hello, all. I’ll start this post off with - this is a test. :P I have the same topic posted at /r/… seeing if I get any l<3ve over here!!! I hope so!!! LemmyNet for the WiN!

I have two domains that I pay for… lets call them domain1.com and domain2.com. I’m running a Bitwarden docker container that uses nginx to serve the website… its address is bitwarden.domain1.com .

I’m running a HUGO website with Apache2… its address is domain2.com .

I have one local IP address; currently, I forward ports 80 & 443 to the local IP of the Bitwarden VM. So… thats my issue; I don’t understand how to forward these two different services to the domains that I want them on… I’ve read about Apache2’s vhosts - but the websites are on different VMs, and the Bitwarden docker container uses nginx.

I’ve thought about condensing and putting both services in one VM; but theres still the apache2/nginx issue. I’ve heard someone mention I should use a third VM to route the traffic to the correct local IPs - but I don’t know what software I’d use.

I’ve thought about using a Cloudflare tunnel for one of those services; but I don’t really want to pay, and aren’t sure how fast a free Cloudflare tunnel would be - this might be a solution for the Bitwarden service, as I’m the only one accessing it…

Does anyone have any suggestions? I’m sure I’m just novice enough that I don’t see the obvious solution - and I’d love to get both sites up and running. Thanks for any input or help!!!

pAULIE42o . . . . . . . . . . . /s

  • 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

    • Thanks so much for the reply; others have mentioned the same, or similar, but your response spelled it out… I knew this was what I needed to do [scenerio 2] but I just didn’t have experience with setting up the proxy - I’m technical enough to RTFM and will get this setup today; one thing that was kinda fudging me up was that my Bitwarden machine, where the domain currenty forwards to, runs in a docker container - so I think I’ll actually forward the OTHER domain to the ‘lemmy’ [although its not lemmy, just using your example as the reference…] machine that’s just an Ubuntu server running apache2 for serving the website - and I’ll probably end up using Apache’s Name Based Virtual Host Support instead of your nginx-proxy suggestion - either way, I think its accomplishing the same.

      Appreciate your, and all the other, replies - this thread literally performed better than on the /r/ platform! I’m sold on LemmyNet!