I know that I can use 3rd party services to set up a tunnel, like Cloudflare, but I’d like to implement this myself.
I feel like every time I research this question I find all kinds of blogs / form posts across the timescape on the topic, and I’m just looking for whatever might be the most current or recommended best method of configuring a VPS tunnel. I’m behind a CG-Nat which is why I want to set one up.
If you’ve done this recently yourself, where did you get your info from?
Thanks!
I don’t have a particular guide to reocmmend, but assuming you have a VPS already, you’ll basically need just a few components:
That should basically do what you need. The reverse proxy will see the domain (https://whatever.example.com) and pass it on to the machine on your local network (e.g. 192.168.1.111:8888) via a VPN connection (which will push the routes so the VPS knows how to get to your local network).
So here is a question: does it need to be a sub domain? Can’t I redirect all traffic to the VPS? If I wanted to host a HTML website at my root domain and have it served by nginx for example, couldn’t I do that?
I just see subdomain mentioned in the guides / tools I see but I don’t understand why exactly.
Hey, it definitely doesn’t have to be just a subdomain. You can have a record for example.com point to your VPS’s IP at the same time you have www.example.com, nextcloud.example.com, and jellyfin.example.com. Have as many services and domains as you like and the reverse proxy will direct the traffic to the correct local server based on the domain name.
One way you can do this flexibly is to have two records in your DNS: an A record pointing example.com to your VPS and a CNAME pointing *.example.com to example.com. That way, any subdomain will go to your VPS and you only have to add new services in the reverse proxy.