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:255.255.255.255
gateway:153.0.68.1
DNS:114.114.114.114 223.5.5.5
LAN
MAC:ommitted for privacy
IP :192.168.1.1
subnet mask:255.255.255.0
DHCP:active
ifconfig
inet addr:192.168.1.100 Bcast:192.168.1.255 Mask:255.255.255.0
My goal: let the public access my wordpress site on the home pc with vps_ip digitalocean gave me.
Thank to CrypticDesigns .
https://www.digitalocean.com/community/questions/how-to-map-my-local-ip-192-168-1-100-with-my-vps_ip?
I have solved the problem with the help of CrypticDesigns.
In my local network:
On my router portforward port 80 and private ip 192.168.1.100 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 vpsip 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 publicip 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 :
1.in my home pc
The command curl ipinfo.io/ip can get my public ip.
Write it into crontab for every 30 minutes.
2.send the vpsip and change the value of publicip in /etc/nginx/sites-available/default
,and restart nginx.
How to express the two steps with shell command to make the process automatic?