Connect to DigitalOcean droplet localhost through WireGuard

Hey there,

I used a PiVPN setup at home and was able to access localhost resources using my mobile phone successfully. I now however am looking to access some localhost resources hosted on a DigitalOcean doplet. I have managed to install PiVPN the same way, and I am able to connect to the wireguard server and route all traffic through the VPS successfully (my IP shows as the DigitalOcean server IP).

What I can not do however, is access localhost resources. For testing I installed an Nginx server running on localhost, which is at on the droplet, but I can not reach this from my home computer.

Configs are as follows:

Home computer (named alice for testing):


PrivateKey = ILLHtp3d6qyP2wfWvBgsys3tTGfLUv6at7Jf9t/Y2X4=

Address =

DNS =,


PublicKey = XXX

PresharedKey = XXX

Endpoint = XX.XX.XX.XX:51820 (VPS IP address)

AllowedIPs =, ::0/0

WireGuard server:


PrivateKey = XXX

Address =

ListenPort = 51820

PostUp = iptables -A FORWARD -i %i -j ACCEPT; iptables -A FORWARD -o %i -j ACCEPT; iptables -t nat -A POSTROUTING -o eth0 -j MASQ>

PostDown = iptables -D FORWARD -i %i -j ACCEPT; iptables -D FORWARD -o %i -j ACCEPT; iptables -t nat -D POSTROUTING -o eth0 -j MA>

### begin alice ###


PublicKey = XXX

PresharedKey = XXX

AllowedIPs =

### end alice ###

Some extra notes:

  • I can reach the Nginx server with curl on the VPS, the Nginx server does run
  • I am able to ping and from the home computer

Any help would be appreciated!

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Hello, @Nafalgar

Have you checked if the Nginx port is not blocked on the DigitalOcean droplet or if the outgoing port is blocked on the local server? You can use telnet in order to test that.

  1. telnet DropletIP NginxPort

Also, are you planning to use the DigitalOcean droplet as a proxy to the local server?

Regards, Alex