I am working on a client's website which is currently hosted on an external remote server. I downloaded a copy of the site to my local computer, which is running a 'LAMP stack' set up on Arch Linux, to use as a development version.
The site is built with WordPress, so the site's domain is stored in the database and this is used whenever links are generated on the site. So, to save from editing the database I configured the site in Apache with a virtual host and set the server's domain name to be the same as that of the 'live' site, e.g. in my 'vhosts.conf' file...
ServerName live-domain-name.co.uk ServerAlias *.live-domain-name.co.uk
I also added the domain to my local 'hosts' file as:
What I would like to be able to do is access both sites from my browser, at least so that if I have Apache running I get my local copy of the site, but if Apache isn't running then I get the 'real' version of the site!
I have added
127.0.0.1 as the first 'nameserver' entry in my
/etc/resolv.conf file, the second being my internet router's IP and I also have one of Goolge's public DNS servers as the third. However even when Apache is not running
$ ping ... still shows the IP for the domain as 127.0.0.1!
I'm guessing that I need some kind of DNS resolver that will check my localhost first but if the site is not found (i.e. Apache is not running) then it will fall-back to using one of the other DNS servers! -- only I have no clue about installing and configuring a DNS server/forwarder...
Can anyone help me please?