| 46 | |
| 47 | == Multiple Projects under Plesk/suEXEC/same domain == |
| 48 | |
| 49 | '''Added by torgny at sbbs.se''' |
| 50 | |
| 51 | The above script works well if you want to have a Trac |
| 52 | instance for each user, but it does not really help if you have |
| 53 | several projects under the same site. In order to solve this under |
| 54 | Linux Red Hat with Plesk, I did the following: |
| 55 | |
| 56 | First, from the Apache configuration ('''vhost.conf''' in this case), |
| 57 | replace '''DOMAIN''' with the domain you are adding: |
| 58 | {{{ |
| 59 | RewriteEngine on |
| 60 | RewriteRule ^/projects/+$ /projects/index.php [L] |
| 61 | RewriteCond /home/httpd/vhosts/DOMAIN/private/tracs/$1 -d |
| 62 | RewriteRule ^/projects/([^/]+)(/?.*) /projects/wrap.cgi$2 [S=1,E=TRAC_ENV:/home/httpd/vhosts/DOMAIN/private/tracs/$1] |
| 63 | RewriteRule ^/projects/(.*) /projects/index.php |
| 64 | |
| 65 | Alias /trac/ /usr/share/trac/htdocs/ |
| 66 | |
| 67 | <Directory "/usr/share/trac/htdocs"> |
| 68 | Options Indexes MultiViews |
| 69 | AllowOverride None |
| 70 | Order allow,deny |
| 71 | Allow from all |
| 72 | </Directory> |
| 73 | |
| 74 | <Directory "/home/httpd/vhosts/DOMAIN/httpdocs/projects"> |
| 75 | AllowOverride None |
| 76 | Options ExecCGI -MultiViews +SymLinksIfOwnerMatch |
| 77 | AddHandler cgi-script .cgi |
| 78 | Order allow,deny |
| 79 | Allow from all |
| 80 | </Directory> |
| 81 | |
| 82 | <LocationMatch "/projects/[[:alnum:]]+/login"> |
| 83 | AuthType Basic |
| 84 | AuthName "Trac" |
| 85 | AuthUserFile /home/httpd/vhosts/DOMAIN/private/.htpasswd_trac |
| 86 | Require valid-user |
| 87 | </LocationMatch> |
| 88 | }}} |
| 89 | |
| 90 | And after that, add the folder to '''~/httpdocs/projects'''. |
| 91 | |
| 92 | In that folder, either symlink '''trac.cgi''' or place a copy, and add '''index.html'''. |
| 93 | |
| 94 | Index.php acts as the default page when a project without an existing |
| 95 | Trac environment is requested. |
| 96 | |
| 97 | Now, for the wrap.cgi bash script: |
| 98 | {{{ |
| 99 | #!/bin/bash |
| 100 | project="${SCRIPT_NAME#/projects/}" |
| 101 | export TRAC_ENV="/home/httpd/vhosts/DOMAIN/private/tracs/${project}" |
| 102 | export SCRIPT_NAME="/projects/${project}" |
| 103 | export PATH_INFO="${PATH_INFO#/${SCRIPT_NAME}}" |
| 104 | exec ./trac.cgi |
| 105 | }}} |
| 106 | |
| 107 | The script above does all the work-around magic to make sure everything |
| 108 | works between suEXEC and Trac in CGI mode. It also gives you multiple |
| 109 | projects support. |
| 110 | |