Basically what I want to do is make a local home server accessible publicly in the internet. Unfortunately my ISP is using CGNAT and to get a public ip, I need to pay extra (around $50). I figured it's cheaper to use VPS instead.
So I have setup a Wireguard Server in Google Cloud via Compute Engine VM running Ubuntu 20.04. I also setup a Wireguard Client for my local server at home and connected it to the Wirequard server in Google Cloud. Lastly I setup another Wireguard client on my Android phone, connected it to the server and everything is working fine. When I'm on wireguard on my android phone, I can see my local server from the outside (using mobile data for testing purposes).
Now I want to make the local server at home available to the public. I have a domain and setup the necessary records. When I ping it, it returns the public ip of the GCE VM which I believe means its working fine. Next I installed Nginx in my GCE VM. Got this running fine. I was able to access the default Nginx page via the domain and public ip address. I then modified the default config using the following and restarted Nginx after.
server {
listen 80;
listen [::]:80;
server_name sub.domain.org; #sample only
location / {
proxy_redirect http://10.200.200.2 http://sub.domain.org;
}
}
My Wireguard is on the 10.200.200.x ip range (not sure if this is the correct term) and 10.200.200.2 is the wireguard ip address of my local home server.
I may not have understood how Nginx work but I was expecting that thru Nginx, I will be able to access my local home server publicly by browsing http://sub.domain.org. Unfortunately I was not able to access it publicly. It is only accessible when I connect to wireguard.
Is there anything else that I need to do?
Appreciate any feedback.