February 2, 2009

Apache2 VirtualHost and trac behind a lighttpd proxy

Note to self:
setup of trac for Apache2

follow this instructions on this site: Robert Basic: Trac on Ubuntu.
Although I use mercurial as scm.
make sure that the line containing VirtualHost points to port 81 or another port except port 80.

<VirtualHost *:81>
and make sure apache listens to this port by changing /etc/apache2/ports.conf
NameVirtualHost *:81
Listen 81

Now install lighttpd:

sudo apt-get install lighttpd

edit /etc/lighttpd/conf-available/10-proxy

$HTTP["host"] == "localhost" {
proxy.debug = 1
proxy.server     = ( "/trac" =>
                       ( "host" => "",
                         "port" => 81,
and symlink:
sudo ln -s /etc/lighttpd/conf-available/10-proxy /etc/lighttpd/conf-enabled/10-proxy

and start lighttpd
sudo /etc/init.d/lighttpd restart
et voilĂ 
the trac instance works both under localhost/trac as well as localhost:81/trac