Basic Multiproject under Litespeed
This document specifies how to modify an existing Trac setup to work with Litespeed. It assumes you have a working Trac install which can serve single Trac projects using the tracd server.
This document assumes some default paths, such as
for the basic Trac installation.
This document _also_ assumes you wish to setup Trac to use a dedicated subdomain. It should be trivial, however, to change this behaviour.
Allowing project-based URL's in Trac
Edit the Trac main.py file. On Linux this file can be found in /usr/lib/python-[ver]/site-packages/trac/web/main.py where [ver] is replaced with your python version (such as 2.4).
Replace the line
env.href = Href(req.cgi_location)
env.href = Href(req.base_url)
save and exit
This modification allows Trac to generate URL's based on the project path rather than the cgi path.
You will also need to add the following line to each of your project's trac.ini files manually.
Under [trac] add
base_url = /projects/[projectname]
The following example will make the 'test' project accessable at http://yourdomain.tld/projects/test
base_url = /projects/test
Creating Litespeed Config
Using the Litespeed configuration panel
- Create a Trac virtual host
- Enable scripting and Symlink Following support
- Enable URL rewrite support
- Insert the following rewrite rules
RewriteRule ^/projects/([[:alnum:]]+)(/?.*) /trac.cgi$2 [S=1,E=TRAC_ENV:/trac/$1,E=TRAC_URI_ROOT:/projects/$1] RewriteRule ^/projects/(.*) /index.html
- Add a Static context with the following
- URI: /trac.cgi/chrome/common
- Location: /usr/share/trac/htdocs
- Accessible: Yes
- Enable Expires: No
- Create a CGI context with the following
- URI: /
- Path: /usr/share/trac/cgi-bin/
- Save and reload Litespeed
This will make project accessable through the address
To set up a basic catch-all security net for your projects, simply follow this guide
- Create a new security realm using the Litespeed config and point it to your Password file.
- Don't have one, use http://sherylcanter.com/encrypt.php to generate username:password combos.
- Assign the security realm to the Trac CGI context.
- Trac will be able understand this security context.