Lighty config

After attempting to get URL rewriting in lighttpd and failing miserably, I’m going to run lighttpd through Apache 2’s mod_proxy. At present, requests for www.oobaloo.co.uk are being served through lighttpd. It should also make it easier to keep separate site instances running.

At first I tried using mod_proxy to redirect all requests to lighty, and then rewrite the URLs that included the blog directory to remove it. I tried the following in my lighttpd.conf configuration file:

url.rewrite-once = ("^/blog(.*)$" => "$1")

To rewrite any /blog/blah to /blah. Unfortunately, this just wasn’t working.

In the end I’ve settled on the following—separate lighttpd instances will bind on high ports, and Apache will then handle the proxying to the lighty backend.

I have the following entries in my Apache configuration for the virtual host:

ProxyPass /blog/ http://127.0.0.1:8001/ProxyPass / http://127.0.0.1:8001/ProxyPassReverse /blog/ http://127.0.0.1:8001/ProxyPassReverse / http://127.0.0.1:8001/

This results in the same effect - existing URLs work fine, and the new site also works as expected, and I don’t need to make any changes to my DNS zone - awesome!