Apache Tips

From trapsink.com
Jump to: navigation, search


Admin Proxying

When using multiple webservers in a load balancer, it's common that one node will be the "admin" node that is preferred for edits. Maybe it's writing to the Master in a MySQL multi-slave or MMM config, (r)syncing it's disk out to all the other nodes, puppetmaster/chef admin node, etc.

Using a simple Apache reverse proxy on all the nodes *except* the admin node can be handy, for instance in a Wordpress setup.

  # 192.168.3.3 = admin node private IP
  ProxyRequests Off
  ProxyPreserveHost Off
  ProxyVia Off
  <Location "/wp-login.php">
    Header set "Host" "www.myblog.com"
    ProxyPass http://192.168.3.3/wp-login.php
    ProxyPassReverse http://192.168.3.3/wp-login.php
  </Location>
  <Location "/wp-admin">
    Header set "Host" "www.myblog.com"
    ProxyPass http://192.168.3.3/wp-admin
    ProxyPassReverse http://192.168.3.3/wp-admin
  </Location>