Expose local server to the world using VPN

Tools :

  1. Raspberry PI as local server ( you can use your pc too but must be linux ).

2. A droplet ( Ubuntu 14.04.* ) from digital ocean to get static IP.

Now lets start,

First create a droplet in digital ocean.

Then to install VPN execute,

If you see output like above, server setup done.

Now in Raspberry PI install VPN client,

To do that execute,

If you see output like below, you’re done.

You are now connected to VPN. A P2P tunnel has been created. We will use the tunnel to provide data from local machine.

Now route requests from droplet to local server.

Install nginx in droplet by,

sudo apt-get install nginx

and a web server in local machine as you like.

Then in droplet get network config by

ifconfig

ppp* are your vpn client connections. Get the p-t-p address of your local machine from the list. In this is case it is 192.168.2.10

You are almost done. Now change the nginx server config at

/etc/nginx/sites-enabled/default

Now restart nginx.

sudo service nginx restart

Now all the http requests come to your droplet will redirect to your local machine and served by local server.