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 for the basic Trac installation, such as:
- /usr/share/trac/
- /usr/lib/python-[ver]/site-packages/trac/
This document also assumes you wish to setup Trac to use a dedicated subdomain. It should be trivial to change this behavior however.
Allowing project-based URL's in Trac
Edit the Trac main.py file. On Linux this file can be found in /usr/lib/python-[x.y]/site-packages/trac/web/main.py where [x.y] is replaced with your Python version (such as 2.4).
Replace the line:
env.href = Href(req.cgi_location)
with:
env.href = Href(req.base_url)
This modification allows Trac to generate URL's based on the project path rather than the CGI path.
Edit the trac.ini file. 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 the 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:
http://subdomain.domain.tld/projects/[projectname]
Basic Security
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.
- If you 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.
See also: BloodHound