Edgewall Software

Changes between Version 2 and Version 3 of ApacheSuexec


Ignore:
Timestamp:
Nov 11, 2004, 10:25:24 PM (19 years ago)
Author:
daniel
Comment:

Edited and added text about multiple projects

Legend:

Unmodified
Added
Removed
Modified
  • ApacheSuexec

    v2 v3  
    1 == Apache suEXEC ==
     1= Trac and Apache suEXEC =
    22
    3 Setting the TRAC_ENV environment variable as described in TracInstall will not work when using [http://httpd.apache.org/docs/suexec.html Apache suEXEC] feature because the environment variables are filtered and only a subset reaches the cgi program.
     3Trac in CGI-mode doesn't play very well with [http://httpd.apache.org/docs/suexec.html Apache suEXEC].
    44
    5 So, we have two choices:
    6  * Recompile suexec to let it pass the TRAC_ENV variable, not advised, so I'll not explain how to do it.
    7  * Change our trac.cgi script to set the TRAC_ENV variable by itself, to do this we edit trac.cgi file and add
     5Setting the TRAC_ENV environment variable as described in TracInstall will not work when using suEXEC feature because the environment variables are filtered and only a limited subset reaches the CGI program.
     6
     7There are two obvious workarounds to make things work:
     8 1. Recompile suexec to let it pass the TRAC_ENV variable; which requires root permissions and is not really advisable anyway.
     9 2. Change our trac.cgi script to set the TRAC_ENV variable by itself, to do this we edit trac.cgi file and add
    810
    911{{{
     
    1113}}}
    1214
    13 before the `try:' line.
     15at the very beginning of the script.
     16
     17'''Note: This is a kludge, but works.'''
     18
     19----
     20
     21== Multiple Projects under suEXEC ==
     22When hosting multiple projects under suEXEC, you can either copy the CGI script and change the TRAC_ENV setting for each script, or make a wrapper script around it.
     23
     24Here's a contributed script to work around the stripping of environment variables done by suEXEC.
     25
     26{{{
     27
     28 #!/bin/bash
     29 user="marcenuc"
     30
     31 prj="${PATH_INFO#/}"
     32 prj="${prj%%/*}"
     33 export TRAC_ENV="/home/${user}/.trac/prj/${prj}"
     34 export SCRIPT_NAME="/~${user}/prj/${prj}"
     35 export PATH_INFO="${PATH_INFO#/${prj}}"
     36 export PYTHONPATH="/home/${user}/sw/lib/python2.3/site-packages"
     37 exec ./trac.cgi
     38}}}
     39
     40----
     41See also: TracInstall, TracMultipleProjects