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.


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.

  • 1
    That is general web mastering/devops/whatever question that is not specific to wordpress in ny way and therefor off-topic here Jun 3, 2016 at 15:20
  • where do you suggest this question be asked in StaEx?
    – doctorate
    Jun 3, 2016 at 15:21
  • I actually have no idea, you can go to "the loop" chat here and ask pwoplw that are more familiar with the network than me Jun 3, 2016 at 15:23
  • 2
    @MarkKaplun server configuration for WordPress is explicitly on topic, though some questions can surely get too far from WP.
    – Rarst
    Jun 3, 2016 at 15:44
  • @Rarst, this is why you are the moderator and not me ;) Jun 3, 2016 at 16:05

1 Answer 1


WordPress doesn't care much about IP address, it is mostly sensitive to domain name it is accessed by.

In your case you can access the test site if you make your local machine resolve domain to its IP (ignoring "actual" IP DNS would resolve it to).

You can accomplish that with hosts file or software that emulates DNS locally (if you need to do that a lot).

While this is perfectly workable I think it is more common to simply stage WP site on dedicated separate domain name. For example that makes easier to give someone link to the site to take a look.

  • This depends on what kind of testing you want to do. The path of least resistance is to duplicate a droplet (I guess we are talking about digital ocean here). which gives you new IP. Going subdomain means much more work as you have to update your DNS setting, your nginx configuration and probably convert all uthe internal url (config file, images etc) to the subdomain. So the answer comes back to what is it that needs to be tested and how frequently you are going to do it, because if you do it a lot you might better create a special droplet for that and have a sync script Jun 3, 2016 at 16:20
  • I assume the testing is frequent, whenever I want to do some major changes to the website without meddling with the live site. So yes, as mentioned in the post, I create a special droplet for it (which has a different IP) and do the testing there until everything is fine, implement those changes to the old live droplet, destroy the new test droplet when done. This works well especially in case where VPS droplets charge hourly.
    – doctorate
    Jun 3, 2016 at 16:32
  • so your suggestion would require having a dedicated domain name rather than a new VPS droplet instance with the same domain name. Is that right?
    – doctorate
    Jun 3, 2016 at 16:40
  • Just go with what makes sense for your needs. For your question as stated the hosts file technique will give you access to test server, bypassing DNS.
    – Rarst
    Jun 3, 2016 at 16:47
  • I am more inclined to use new droplet path rather than new domain name for sake of testing. I think VPS charging hourly vs longer period in case of domains makes it an attractive choice. Besides, better off no playing much with domain namespaces. So the hosts file seems to be the solution to the first method. Here not enough space so please have a look at the update.
    – doctorate
    Jun 3, 2016 at 16:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.