💾 Archived View for chirale.org › 2016-01-11_1335.gmi captured on 2024-12-17 at 10:14:45. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2024-05-12)
-=-=-=-=-=-=-
Scenario: An obsolete server hosting a website must be put offline and a new one must take his IP address. You don’t want to change all of yours A records on DNS to put online your new website, just exchange the internal IP address of your local network.
Your provider can exchange the addresses to assign the old IP public address to the new internal IP but it takes his time. How to cover the time between the provider action and your new website online?
Haproxy is the answer.
This is the content of the /etc/haproxy/haproxy.cfg:
#--------------------------------------------------------------------- # main frontend which proxys to the backends #--------------------------------------------------------------------- # redirect all traffic on :80 to another server frontend main *:80 default_backend app backend app balance roundrobin # where x.x is the internal address of the new server server app1 x.x:80 check
And then restart haproxy (e.g. on centos 6 service haproxy restart).
Before configuring haproxy remember to stop or reconfigure the service listening to the port If for example you want to reconfigure apache you have to change Listen 80 into something like Listen 8081 in /etc/httpd/conf/httpd.conf (CentOS 6 systems), if you have varnish listening to the 80 you have to change the VARNISH_LISTEN_PORT parameter in /etc/sysconfig/varnish.
Now all the traffic arriving to the old server on port 80 will be redirected to the new server via local network. When the provider will exchange the addresses you haven’t to change anything. Meanwhile, you can test all the production settings prior to the real internal IP exchange.
https://web.archive.org/web/20160111000000*/http://www.haproxy.org/