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

  • pAULIE42o@beehaw.orgOP
    link
    fedilink
    arrow-up
    2
    arrow-down
    1
    ·
    1 year ago

    LOL… it’ll be easy, I tell ya!

    So I dove in this afternoon, thinking I had all the info I needed to easily get a setup w0rking… I changed my port forwards to the domain2.com machine - the one running apache2 on a webiste; leaving the bitwarden.domain1.com not seeing traffic. Then, I created a new virtual host file on the domain2.com machine;

    cat bitwarden.domain1.com.conf

    <VirtualHost *:80>

        ServerName bitwarden.domain1.com
    
        ProxyPass / http://10.0.0.155/ nocanon
    
        ProxyPassReverse / http://10.0.0.155/
    
        ServerAdmin [email protected]
    
    ErrorLog ${APACHE_LOG_DIR}/error.log
    
    CustomLog ${APACHE_LOG_DIR}/access.log combined
    

    RewriteEngine on

    RewriteCond %{SERVER_NAME} =bitwarden.domain1.com

    RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]

    </VirtualHost>

    And ran certbot to get https certs - certification would only be on the domain2.com machine; all proxied data would be sent over http, but I figured that was OK as its just me accessing the domain1.com service.

    BUT alas, the setup didn’t work; I have some suspicions… bitwarden is running inside a docker container, so… I dunno if that has something to do with how its listening, and its running nginx; what I thought was that apache2 would simply send all traffic from the bitwarden.domain1.com domain over to my local IP 10.0.0.155 machine and that machine would just pick it up simple pimple and display to the user going to that domain. Another thought - maybe its because Docker/Bitwarden HAS https in that container - ohhhh, thats a thought; however it still didn’t function correctly before I ran certbot on the domain2.com setup.

    UGH… more to come - I’m trying options. :/ Grrrrrr. :P

    PS; posting code in Lemmy doesn’t work so great, does it? I used a backtick but didn’t get the results I’m accustomed to…

    • alyaza [they/she]@beehaw.orgM
      link
      fedilink
      English
      arrow-up
      3
      ·
      1 year ago

      PS; posting code in Lemmy doesn’t work so great, does it? I used a backtick but didn’t get the results I’m accustomed to…

      it might be because lemmy uses commonmark instead of regular markdown, so the formatting is slightly different from… most markdown things, i guess?