I have two identical servers, one with IP address 1.1.1.1 and one with IP address 2.2.2.2.
They both run Ubuntu with Apache 2.4.
I have a domain name. It's A record is set to 1.1.1.1.
I want to be able to quickly change this so that without modifying the DNS, the site is served from 2.2.2.2.
Effectively I want server 1.1.1.1 to be able to say "pass through me, I'll proxy 2.2.2.2 to you seamlessly".
Is this possible/straightforward?
This would be a temporary measure. We can assume that 1.1.1.1 and 2.2.2.2 are permanently on, and have a good network connection between them.
You can definitely tell Apache to reverse-proxy requests to another host.
Enable the relevant Apache modules. On Debian and Ubuntu, that's something like:
Then configure the reverse-proxy in the Apache config on 1.1.1.1. On Debian and Ubuntu, you'll probably want to use a "site" in
/etc/sites-available
.Something like this should work:
The full documentation for mod_proxy has more details.