I have a few things that I host from my house. I have read that it’s better practice to route stuff through a VPS to not expose your home IP.

Here’s what I’ve done so far: VPN setup on VPS with successful routing of containers. Confirmed by using a CLI IP check within the container which returned the VPS IP. I used PiVPN because I know it and it’s easy to set up.

Where I got stuck: I pointed Nginx to the supposed IP:port of the connection, but couldn’t get it to load.

What should I do next?

  • Darkassassin07@lemmy.ca
    link
    fedilink
    English
    arrow-up
    1
    ·
    edit-2
    2 days ago

    This part always confuses me, so I won’t be able to give specifics; just a general direction. Most guides explain how to route traffic from a vpn client to the lan of the vpn host. You need to route traffic from the vpn host/lan to a client of the vpn.

    You need to change the routing table on the VPS, adding a static route to route traffic heading for your VPNs subnet to the VPN host instead of out the default gateway.

    How exactly to do that I’ll have to leave to someone else unfortunately. Network config confuses the hell out of me.

  • catloaf@lemm.ee
    link
    fedilink
    English
    arrow-up
    0
    ·
    3 days ago

    VPN setup on VPS with successful routing of containers. Confirmed by using a CLI IP check within the container which returned the VPS IP

    If you want to route traffic from the VPS over the VPN, and the check returned the IP address of the VPS, this confirms it is not working. You need to configure your VPS to route traffic over the VPN. Personally, I’ve done this in the reverse direction (routing local qbittorrent to a public VPN) with gluetun.

    • jws_shadotak@sh.itjust.worksOP
      link
      fedilink
      English
      arrow-up
      0
      ·
      3 days ago

      I think you got it reversed. I want the container traffic to go through the VPN to the VPS and I want the reverse proxy on the VPS to point to that container.

      I want the website (hosted at my house) to be accessible through the VPS so my IP isn’t directly exposed.

      • catloaf@lemm.ee
        link
        fedilink
        English
        arrow-up
        0
        ·
        3 days ago

        You’ve confirmed I’ve understood it correctly. Someone on the Internet requests your site. They reach your VPS with nginx. So far so good. Now, how does nginx know how to reach the upstream service?