| 1 | = Basic Multiproject under Litespeed = |
| 2 | |
| 3 | This document specifies how to modify an existing Trac setup to work with [http://litespeedtech.com/ Litespeed]. It assumes you have a working Trac install which can serve single Trac projects using the tracd server. |
| 4 | |
| 5 | This document assumes some default paths, such as |
| 6 | * /usr/share/trac/ |
| 7 | * /usr/lib/python-[ver]/site-packages/trac/ |
| 8 | for the basic Trac installation. |
| 9 | |
| 10 | This document _also_ assumes you wish to setup Trac to use a dedicated subdomain. It should be trivial, however, to change this behaviour. |
| 11 | |
| 12 | == Allowing project-based URL's in Trac == |
| 13 | |
| 14 | 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). |
| 15 | |
| 16 | Replace the line |
| 17 | {{{ |
| 18 | env.href = Href(req.cgi_location) |
| 19 | }}} |
| 20 | with |
| 21 | {{{ |
| 22 | env.href = Href(req.base_url) |
| 23 | }}} |
| 24 | save and exit |
| 25 | |
| 26 | This modification allows Trac to generate URL's based on the __project path__ rather than the cgi path. |
| 27 | |
| 28 | You will also need to add the following line to each of your project's trac.ini files manually. |
| 29 | |
| 30 | Under [trac] add |
| 31 | {{{ |
| 32 | base_url = /projects/[projectname] |
| 33 | }}} |
| 34 | |
| 35 | The following example will make the 'test' project accessable at http://yourdomain.tld/projects/test |
| 36 | {{{ |
| 37 | base_url = /projects/test |
| 38 | }}} |
| 39 | |
| 40 | == Creating Litespeed Config == |
| 41 | |
| 42 | Using the Litespeed configuration panel |
| 43 | |
| 44 | * Create a Trac virtual host |
| 45 | * Enable scripting and Symlink Following support |
| 46 | * Enable URL rewrite support |
| 47 | * Insert the following rewrite rules |
| 48 | {{{ |
| 49 | RewriteRule ^/projects/([[:alnum:]]+)(/?.*) /trac.cgi$2 [S=1,E=TRAC_ENV:/trac/$1,E=TRAC_URI_ROOT:/projects/$1] |
| 50 | RewriteRule ^/projects/(.*) /index.html |
| 51 | }}} |
| 52 | * Add a Static context with the following |
| 53 | * URI: /trac.cgi/chrome/common |
| 54 | * Location: /usr/share/trac/htdocs |
| 55 | * Accessible: Yes |
| 56 | * Enable Expires: No |
| 57 | |
| 58 | * Create a CGI context with the following |
| 59 | * URI: / |
| 60 | * Path: /usr/share/trac/cgi-bin/ |
| 61 | |
| 62 | * Save and reload Litespeed |
| 63 | |
| 64 | This will make project accessable through the address |
| 65 | {{{ |
| 66 | http://subdomain.domain.tld/projects/[projectname] |
| 67 | }}} |