Edgewall Software

Changes between Version 20 and Version 21 of TracCgi


Ignore:
Timestamp:
Aug 26, 2006, 11:10:10 PM (18 years ago)
Author:
Christopher Lenz
Comment:

Minor cleanup

Legend:

Unmodified
Added
Removed
Modified
  • TracCgi

    v20 v21  
    11= Installing Trac as CGI =
    22
    3 To install Trac as a CGI script, you need to make the `trac.cgi` executable as a CGI by your web server. Please note that doing this is quite a bit slower than using the TracModPython method. If you're using [http://httpd.apache.org/ Apache HTTPD], there are a couple ways to do that:
     3To install Trac as a CGI script, you need to make the `trac.cgi` executable as a CGI by your web server.
     4
     5  ''Please note that using Trac via CGI is significantly slower than any other deployment method, such as [TracModPython mod_python] or [TracFastCgi FastCGI].''
     6
     7If you're using [http://httpd.apache.org/ Apache HTTPD], there are a couple ways to do that:
    48
    59 1. Use a `ScriptAlias` to map a URL to the `trac.cgi` script
     
    1317}}}
    1418
    15 If you're using Trac with a single project set its location:
     19 ''Note that this directive requires the `mod_alias` module to be installed and enabled.''
     20
     21If you're using Trac with a single project you need to set its location using the `TRAC_ENV` environment variable:
    1622{{{
    1723<Location "/trac">
     
    2026}}}
    2127
    22 Or to use multiple projects from a parent directory:
     28Or to use multiple projects you can specify their common parent directory using the `TRAC_ENV_PARENT_DIR` variable:
    2329{{{
    2430<Location "/trac">
     
    2733}}}
    2834
    29  ''Note: Make sure that the modules mod_alias and mod_env modules are available and enabled in your Apache configuration, otherwise Apache will complain about the above snippet.''
    30 
    31  ''Note: If you are using the [http://httpd.apache.org/docs/suexec.html Apache suEXEC] feature see ApacheSuexec.''
    32 
    33  ''Note: You may need to edit the shebang line in the share/trac/cgi-bin/trac.cgi file in your Python installation to point to your real Python installation path. On a Windows system you may need to configure Windows to know how to execute a .cgi file (Explorer -> Tools -> Folder Options -> File Types -> CGI).
    34 
    35 Alternately, these variables can be set in `trac.cgi` and thus not require
    36 Apache `SetEnv` directives at all, e.g.:
    37 {{{
    38 import os
    39 os.environ['TRAC_ENV'] = "/path/to/projectenv"
    40 }}}
    41 or
    42 {{{
    43 import os
    44 os.environ['TRAC_ENV_PARENT_DIR'] = "/path/to/project/parent/dir"
    45 }}}
    46 Using this method, different projects can be supported by using different
    47 `.cgi` scripts with different `ScriptAliases`, copying and appropriately
    48 renaming `trac.cgi` and adding the above code to create each such script.
     35 ''Note that the `SetEnv` directive requires the `mod_env` module to be installed and enable.''
    4936
    5037This will make Trac available at `http://yourhost.example.org/trac`.
    5138
     39If you are using the [http://httpd.apache.org/docs/suexec.html Apache suEXEC] feature please see [http://trac.edgewall.org/wiki/ApacheSuexec].
     40
     41On some systems, you ''may'' need to edit the shebang line in the `trac.cgi` file to point to your real Python installation path. On a Windows system you may need to configure Windows to know how to execute a .cgi file (Explorer -> Tools -> Folder Options -> File Types -> CGI).
     42
    5243== Mapping Static Resources ==
    5344
    54 Out of the box, Trac will serve static resources such as style sheets or images itself. For a CGI setup, though, this is highly undesirable, because it results in the CGI script being invoked for documents that could be more efficiently served by the web server.
     45Out of the box, Trac will serve static resources such as style sheets or images itself. For a CGI setup, though, this is highly undesirable, because it results in the CGI script being invoked for documents that could be much more efficiently served by the web server directly.
    5546
    5647Web servers such as [http://httpd.apache.org/ Apache HTTPD] allow you to create “Aliases” to resources, thereby giving them a virtual URL that doesn't necessarily bear any resemblance to the layout of the servers file system. We already used this capability above when defining a `ScriptAlias` for the CGI script, and we'll use it now to map requests to the static resources to the directory on the file system that contains them, thereby bypassing the processing of such requests by the CGI script.