Jan Mészáros reflections on technology and society

28Oct/090

Apache virtual host proxy

I had to move some virtual hosts from one server (server "A") to another server (server "B") without changing DNS records for affected domains yesterday. This can be done easily with Apache's mod_proxy module. An example configuration of the server "A" is shown below:

  1. <virtualhost *:*>
  2. ProxyPreserveHost On
  3. ProxyPassReverse / http://192.168.111.2/
  4. ServerName hostname.example.com
  5. </virtualhost>

The ProxyPreserveHost directive preserves the Host HTTP header, which is passed through to the proxied server configured by the ProxyPass directive. Virtual host's configuration on server "B" is the same, which was placed originally on server "A", e.g.:

  1. <virtualhost *:*>
  2. ServerName hostname.example.com
  3. DocumentRoot /var/www/html/hostname.example.com
  4. </virtualhost>

References:

Tagged as: Leave a comment
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment


No trackbacks yet.