I have example.com
up and running on a VPS droplet running Ubuntu 16.04
. The website was built with WordPress on LEMP
stack (Linux EngineX MySql and PHP) which was done using EeasyEngine. EasyEngine would install the LEMP stack automatically.
Suppose I want to experiment with example.com
in another location and replace the old live example.com
with the test example.com
when I am finished.
What I did is that I deployed another droplet with a different IP address of course from the same VPS provider. I installed LEMP + WordPress using EasyEngine with the same domain name example.com
. But I don't know how can I test drive this WordPress installation. I pointed the DNS of the VPS droplet to the new IP address but my browser didn't pick it up.
My question:
Can I only have my machine access the experimental example.com
while all other visitors access the old live example.com
site? when done with my testing I destroy the old droplet and make the new droplet with the tested example.com
accessible to visitors.
If no, what is the best alternative to test drive my website given the above scenario? It might seem silly question to most of you but your help would be much appreciated.
Update
Based on the answer kindly provided by Rarst
:
I did change the hosts
file on my Ubuntu 16.04 local machine as follows:
sudo nano /etc/hosts
and added this line:
<new IP address of VPS droplet 2> example.com
still didn't work, I checked the sequence priority:
grep host /etc/nsswitch.conf
it was:
hosts: files mdns4_minimal [NOTFOUND=return] dns
which should be correct since files take the precedence over dns. I found this here. So what am I missing here? Why cannot my machine access the domain name of the new droplet IP address? it still refers to the old droplet of the live domain.