32 | | Or for windows systems: |
33 | | {{{ |
34 | | RewriteEngine on |
35 | | RewriteRule ^/projects/+$ /projects/index.html [L] |
36 | | #RewriteCond /var/lib/trac/$1 -d |
37 | | RewriteCond d:/svn/$1.db -d |
38 | | RewriteRule ^/projects/([[:alnum:]]+)(/?.*) /projects/trac.cgi$2 [S=1,E=TRAC_ENV:d:/svn/$1.db] |
39 | | RewriteRule ^/projects/(.*) /projects/index.html |
40 | | |
41 | | <Directory "C:\Program Files\Apache Group\Apache2\htdocs\projects"> |
42 | | AllowOverride None |
43 | | Options ExecCGI -MultiViews +SymLinksIfOwnerMatch |
44 | | AddHandler cgi-script .cgi |
45 | | Order allow,deny |
46 | | Allow from all |
47 | | </Directory> |
48 | | |
49 | | <LocationMatch "/projects/[[:alnum:]]+/login"> |
50 | | AuthType Basic |
51 | | AuthName "trac" |
52 | | AuthUserFile D:/svn/.htaccess |
53 | | Require valid-user |
54 | | </LocationMatch> |
55 | | }}} |
56 | | |
65 | | ---- |
66 | | If you have a normal account on a Unix server and you can have your own cgi-scripts launched by suExec, then you can setup trac to serve multiple projects. The main problem is that suExec cleans up your environment and "!SetEnv TRAN_ENV ..." have no effect. |
67 | | |
68 | | I use the following setup. |
69 | | |
70 | | I install Clearsilver: |
71 | | {{{ |
72 | | ./configure --prefix=$HOME/sw |
73 | | make |
74 | | make install |
75 | | cp python/neo_cgi.so ~/sw/lib/python2.3/site-packages/ |
76 | | }}} |
77 | | |
78 | | I install trac: |
79 | | {{{ |
80 | | ./setup.py install --prefix=$HOME/sw |
81 | | cp ~/sw/share/trac/cgi-bin/trac.cgi ~/public_html |
82 | | }}} |
83 | | |
84 | | I create ~/public_html/.htaccess (change "marcenuc" with your username): |
85 | | {{{ |
86 | | Options +ExecCGI |
87 | | DirectoryIndex index.cs index.html |
88 | | Action cs-handler /~marcenuc/static.cgi |
89 | | AddHandler cs-handler .cs |
90 | | AddType text/html .cs |
91 | | |
92 | | RewriteEngine On |
93 | | RewriteBase /~marcenuc |
94 | | |
95 | | RewriteRule ^prj/?$ projects [R,L] |
96 | | RewriteCond /home/marcenuc/.trac/prj/$1 -d |
97 | | RewriteRule ^prj/([[:alnum:]]+)(/?.*) trac-wrapper.cgi/$1$2 [S=1] |
98 | | RewriteRule ^prj/(.*) projects [R,L] |
99 | | }}} |
100 | | |
101 | | I create ~/public_html/trac-wrapper.cgi (change "marcenuc" with your username) and make it executable: |
102 | | {{{ |
103 | | |
104 | | #!/bin/bash |
105 | | user="marcenuc" |
106 | | |
107 | | prj="${PATH_INFO#/}" |
108 | | prj="${prj%%/*}" |
109 | | export TRAC_ENV="/home/${user}/.trac/prj/${prj}" |
110 | | export SCRIPT_NAME="/~${user}/prj/${prj}" |
111 | | export PATH_INFO="${PATH_INFO#/${prj}}" |
112 | | export PYTHONPATH="/home/${user}/sw/lib/python2.3/site-packages" |
113 | | |
114 | | exec ./trac.cgi |
115 | | }}} |
116 | | |
117 | | Create your projects repository and trac-environment: |
118 | | {{{ |
119 | | mkdir -p ~/.trac/{prj,svn} |
120 | | svnadmin create ~/.trac/svn/myfirstproject |
121 | | trac-admin ~/.trac/svn/myfirstproject initenv |
122 | | }}} |
123 | | |
124 | | Open http://severname/~username/prj/myfirstproject |