jeremiahx|com J.J. Merrick on Facebook jeremiahx on Twitter

How-To: Sending one directory to one server and another directory to another server via POUND

So I came across an issue today where I needed to make sure that a sub directory off one of our domains only went to 1 server behind the load balancer. Basically we had installed wordpress and since it doesn’t balance very nicely it only needed to be installed on 1 server and the rest of the domain to act normally. The blog resides in a directory called /blog.

We use a program called Pound to do our load balancing. It is open source and can make any server into a load balancer. I love it because it can do SSL and reverse proxy.

It is included with most ports packages and I won’t go into the install here. Basically it uses regular expressions to send a connection to a backend server based on rules. It is totally powered by a single config file. Here is the syntax you will need in that config file…


ListenHTTP
  Address 192.168.5.20
  Port    80

Service
 Url         ".*/(blog|forum)*"
 BackEnd
    Address  192.168.5.105
     Port  80
 End
End

  Service
    BackEnd
      Address 192.168.5.104
      Port    80
    End
    BackEnd
      Address 192.168.5.105
      Port    80
    End
  End
End

That’s it! See how easy that was?!

Leave a Comment