I have a nextcloud instance being hosted from my home network. The URL associated with it points directly at my home’s IP. I don’t want to host the instance on a VPS because disk space is expensive. So, instead, I want to point the URL at the VPS, and then somehow route the connection to my home’s nextcloud instance without leaking my home’s ip.

How might I go about doing this? Can this be achieved with nginx?

EDIT: Actually, not leaking my home’s IP is not essential. It is acceptable if it is possible to determine the IP with some effort. What I really want is to be able to host multiple websites with my single home IP without those websites being obviously connected, and to avoid automatic bots constantly looking for vulnerabilities in my home network.

  • GreenDot 💚@le.fduck.net
    link
    fedilink
    English
    arrow-up
    1
    ·
    edit-2
    1 year ago

    You can set up nginx to do reverse proxy to your home IP, and then limit the traffic on your home IP to the VPS IP.

    You can also setup a wireguard VPN between VPS and your home machine, so the traffic between VPS and your home machine is encrypted.

    For DNS you just point to the VPS, and manage connections there, and on home network allow only VPS IP to connect. Then manage your security on the VPS.

    If you put a wireguad VPN between the VPS and your home machine, you don’t have to open any ingress ports. I’m using a similar setup, where the public VM is handling the incoming connections and reverse proxying it to a small private server in my home.

    Communication is done via wireguard VPN. I’ve used Netmaker to create a VPN connections and the mesh, and have VPN profile created on the phone, so I can reach any of the services I don’t want exposed on the public internet via private VPN ( example: listening to music via Navidrome, or home Emby server so I can watch stuff when I’m on the move and it is not exposed publicly).

    • Max@mander.xyzOP
      link
      fedilink
      English
      arrow-up
      1
      ·
      1 year ago

      Thanks a lot! This is kind of the configuration that I have converged to, with nginx and WireGuard. The last thing I need to set up correctly is for the SSL handshake to occur between the client and my home server, and not between the client and the internet-facing VPS, such that the information remains encrypted and unreadable to the VPS. The two strategies that I have seen can do this is SNI routing with nginx or to use stunnel. I still have not been able to set up either!

      • GreenDot 💚@le.fduck.net
        link
        fedilink
        English
        arrow-up
        1
        ·
        1 year ago

        In that case, you’re better off just using the VPS machine as port forwarding port 443 to your home machine’s wireguard IP address and handle the SSL/TLS termination on the home machine.

        This way all HTTPS traffic will be passing trough the VPS and being decrypted on your home machine, and encrypted data will be sent from your home machine back to the client. Anyone gets in or sniffs traffic will see encrypted traffic. Plus it’s already sent over encrypted VPN network. To really see what’s happening, they need to get into the machine and technically could use the wireguard private keys to decrypt the traffic, but they will still see the encrypted HTTPS traffic. So you’re good, technically.

        • Max@mander.xyzOP
          link
          fedilink
          English
          arrow-up
          2
          ·
          1 year ago

          In that case, you’re better off just using the VPS machine as port forwarding port 443 to your home machine’s wireguard IP address and handle the SSL/TLS termination on the home machine.

          This is what I would like to do! I was trying to handle the SSL termination ‘automatically’ by simply forwarding the connections to 443 of my machine’s wireguard IP using nginx, but I did not manage to get it to work. That’s when I found that I need to use something like ‘stunnel’ to handle the SSL termination. But I think that you may be suggesting an even simpler method of using port-forwarding instead of the reverse proxy. I am not sure how to achieve that, I will look into it using these terms.

          • GreenDot 💚@le.fduck.net
            link
            fedilink
            English
            arrow-up
            2
            ·
            1 year ago

            You did kinda push me in that direction to try the same thing. Once I have bit more time, I’ll try it out and send an example. Unless you beat me to it 😂