How to map my private ip which change dynamically onto my vps_ip in digitaloean's droplet?

I have create a droplet in digitalocean,there is a vps_ip i can use. In my home the way connected to the internet is: route+modem+adsl. I built a wordpress on the local pc on my home. The net status is as below when to connect to the web.

WAN: MAC:ommitted for privacy IP :public_ip PPPoE subnet mask: gateway: DNS:

LAN MAC:ommitted for privacy IP : subnet mask: DHCP:active

ifconfig inet addr: Bcast: Mask:

My goal: let the public access my wordpress site on the home pc with vps_ip digitalocean gave me.

Thank to CrypticDesigns , I have solved the problem with the help of CrypticDesigns.

In my local network:

On my router portforward port 80 and private ip  to the outside of your network.

In public droplet system:

sudo apt-get install nginx
sudo nano /etc/nginx/sites-available/default
server {
    listen *:80;
    server_name vps_ip;
    rewrite .* http://publlic_ip$request_uri permanent; 
sudo service nginx restart

Anyone who go to the vps_ip can browse my wordpress now. It is important that my ip address on the wan changes about every 30 minutes.How about 30 minutes later? The public_ip will change,the configurration file /etc/nginx/sites-available/default can’t work . I want to make improvements on the problem. It is my opinion to make the task done that : my home pc The command curl can get my public ip. Write it into crontab for every 30 minutes. 2.send the vps_ip and change the value of public_ip in /etc/nginx/sites-available/default ,and restart nginx.

How to express the two steps with shell command to make the process automatic?

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.

yes ssh and password to connect to my vps_ip at digitalocean.Do you need it to test the script?

I am anxious to waiting for your script.

dear CrypticDesigns , i have no script to make my target done,would you mind write it for me ?Both the client and server script?