having identical domain names on the same server with different IP numbers

hello all -

one of my favorite debug tricks is to hack into my local etc.hosts file and manually redirect my “A” record from one IP number to another.

we have a situation now where we purchased an expensive license for a software product, but the vendor wont give me a temporary license for testing/debugging purposes, even though the vendor will greatly benefit from my research.

i was wondering if its possible to run two websites with the same identical domain name but with different and unique IP numbers?

both sites, the real and the fake, would be totally and completely independent of each-other.

obviously the real world will never be able to see this new experimental website unless they just happen to use the new IP number.

thank you all for your thoughts !

Do you require (external) DNS resolution for those sites? Then the answer is “no”. While you can enter multiple IP addresses for one hostname into a BIND zone, the IPs will then be randomly returned.

In Apache, each name-based host can of course also point to only one website (i.e. document root). You’d need to use IP-based virtual hosts in Apache then. I’m not sure right now if Virtualmin does that when you use private IP addresses.

EDIT: Yes, you’d of course need to “cheat” Virtualmin by giving the “fake” a different domain name, and then patching the one you need manually into the config files.

i tried just using the same domain name again with a different IP number and got this error message:

Failed to create virtual server : You are already hosting this domain

hmmm interesting – that actually seemed to work, so far! i assume you mean to manually edit the httpd.conf file?

i now have a second IP number. i went into webmin–>apache, “Networking and Addresses”, and added this line into “Addresses for name virtual servers”:

199.231.187.4:80

(the regular [main] IP number was already there of course)

its not working (yet) but i am blown away i even got this far. “Include all addresses” was unchecked – i tried checking it but that didn’t fix it.

so, what must i do to get virtualmin to recognize my new IP number ?

Yes, you'd of course need to "cheat" Virtualmin i feel sorta weird cheating virtualmin. that's like cheating at monopoly.

this can be extremely handy for solving problems on a website where you need to hack at it and you don’t
want to damage anything on your live site.

for example, we have a wordpress website that is running multiuser, but we need to switch it back to
single-user. there does not seem to be any decent tools that are up to the task, so i am going to
attempt to take the live site, clone it, and re-install all the wordpress plugins.

steps to “clone” a website (for testing purposes only):

  1. obtain new IP number

  2. issue the following shell command (substitute your IP number)
    ifconfig eth0:1 ###.###.###.### netmask 255.255.255.224

  3. create the new “fake” domain name in virtualmin

  4. edit /etc/httpd/conf/httpd.conf - your new website should be at the bottom of the file
    4a) change new fake domain name to old existing (live) one [in eight places].
    4b) change SuexecUserGroup from fake one to existing (live) one

  5. copy/tar your old website into the new location created in step three

  6. issue the following shell command:
    chown -R real-domain.name.com:real-domain-name.com /home/fake-domain-name.com/public_html/

  7. in your own local etc.hosts file, add the following two lines at the bottom (include your new IP nbr)

123.123.123.123 real-domain-name.com
123.123.123.123 www.real-domain-name.com

  1. suggestion - somehow alter the “fake” website so you can tell the difference easily.

remember to switch back to your live site when done !