Apache virtual host - one site, two IP addresses [closed]

Solution 1:

If your apache configuration uses the common conventions it already listens at all interfaces, by simply configuring the second IP-address at OS level your website will be reachable on both IP's

E.g. the relevant lines you would often see:

...
Listen 80  
NameVirtualHost *:80
...
<VirtualHost *:80>
  ServerName dummy-host.example
  DocumentRoot /www/docs/dummy-host.example
</VirtualHost>

Now if you have bound Apache to specific IP-addresses your config would look more like something below and you will need to change your configuration:

...
Listen 10.9.8.7:80  
NameVirtualHost 10.9.8.7:80
...
<VirtualHost 10.9.8.7:80>
  ServerName dummy-host.example
  DocumentRoot /www/docs/dummy-host.example
</VirtualHost>

N.B. When changing ip-addresses don't overlook entries in /etc/hosts

Solution 2:

Yes, it can be done. Exactly how you need to change your config depends on how it's setup currently. Copying your virtualhost to have a second one with the new IP address is almost certainly the wrong way.

Read the apache vhost documentation. Change your config, try it out. If it doesn't work, post back with a specific question showing the config you're using, what you tried, what you expect to happen, and what happened instead. Include relevant logfile extracts.