Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm using wordpress on a small e-commerce site (not for the ecommerce, just for the front page and a few others). We would like to get a full duplicate of the site set up on a second server, and then switch over the DNS to the new server's IP address.

Before switching over, of course, we'd like to test out the new server some, update the themes, etc.

I copied over the software and the database, and things seemed ok at first. The new server is accessed just using the IP address, so it's something like http://, and using an Alias in the apache2.conf (this is on Ubuntu) it redirects this to /home/

However, many of the links go to[whatever the link was]. I tried to login to the back end to fix this, and found that even the admin login is redirecting to the real site. So going to http: // sends me to the login page, and when I login it puts me at, logged in.

So I'm getting that feeling that I'm making some basic strategic error here. We have a small site, just one server is plenty (db and code). I just want the ability to set up new OS, db software, blog and ecommerce software, etc. and then switch it over. I thought setting everything up on a second server, and switching the DNS registration to the new IP address, would do this (different customers might not all get the new IP address instantly but within a day or so they all would, and anyway no one would see a site which wasn't ready).

So, what is the better strategy for doing this? I don't want to upgrade things like OS on my production server on the fly, and I want to be able to test the new setup using my browser, with real data in it, which is why I copied the code and database from the current prod server. What is the best overall strategy for handling these issues, in a small shop environment? Is there an apache setup which will let this work, or is there a different way to go about testing the new setup as realistically as possible without making changes to the prod server on the fly?

share|improve this question
up vote 2 down vote accepted

Whenever I'm screwing around with machines that are going to be in production as a name separate than they are now, I make liberal use of lying-through-hosts-file-manipulation.

The only problem will be if you start to use certificates, the IP / name combo in the certificate may not match. I've also seen some licensed software that isn't fooled this way.

On the machine, make sure that your entries in /etc/hosts accurately reflect reality whenever the things switch over. Then, when things change, make sure to take out the host file entries, because things will change in the future, and you don't want a host file screwing you up while at the same time giving you a false negative error indication.

share|improve this answer

Can't you just modify the /etc/hosts file of your workstation and point the domain to the test server? You don't have to touch the configuration of the development server at all. The disadvantage is that modifying the hosts file is pretty annoying and may lead to serious mistakes (doing something on the wrong server).

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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