Edgewall Software

Version 13 (modified by Matthew Good, 19 years ago) ( diff )

multiple project setup example

This page documents the 1.4 (latest stable) release. Documentation for other releases can be found here.

Trac and FastCGI

There is support in the Trac trunk as of [1399] for the FastCGI interface. Like TracModPython, this allows trac to remain resident, and is faster than external CGI interfaces which must start a new process for each page view. However, unlike mod_python, it is able to support SuEXEC. Additionally, it is supported by much wider variety of webservers.

Simple Apache configuration

# Enable fastcgi for .fcgi files
# if using a distro package for mod_fcgi, something like this is probably already done
<IfModule mod_fastcgi.c>
     AddHandler fastcgi-script .fcgi
     FastCgiIpcDir /var/lib/apache2/fastcgi 
</IfModule>
LoadModule fastcgi_module /usr/lib/apache2/modules/mod_fastcgi.so

You can either setup the TRAC_ENV as an overall default:

FastCgiConfig -initial-env TRAC_ENV=/path/to/env/trac

Or you can serve multiple Trac projects in a directory like:

FastCgiConfig -initial-env TRAC_ENV_PARENT_DIR=/parent/dir/of/projects

Configure ScriptAlias or similar options as described in TracInstall, but calling cgi-bin/trac.fcgi instead of cgi-bin/trac.cgi

Simple Lighttpd Configuration

The FastCGI front-end was developed primarily for use with alternative webservers, such as lighttpd.

lighttpd a secure, fast, compliant and very flexible web-server which has been optimized for high-performance
environments.  It has a very low memory footprint compared to other webservers and takes care of cpu-load.

Using TracFastCgi with lighttpd requires that the patch attached to #1305 be applied. You can then add the following to your lighttpd.conf:

fastcgi.server = ("trac.fcgi" => ( "trac.fcgi" => ( "socket" => "/tmp/trac-fastcgi.socket",
                                                    "bin-path" => "/path/to/cgi-bin/trac.fcgi",
                                                    "bin-environment" => ("TRAC_ENV" => "/path/to/env/trac")
                                                  )
                                 )
                 )
alias.url = ( "/cgi-bin/" => "/path/to/cgi-bin/", "/trac/" => "/usr/share/trac/htdocs/")
url.rewrite-final = ("^/trac(.*)" => "/cgi-bin/trac.fcgi$1", "^/trac/?$" => "/trac/timeline/")

Note that you will need to add a new entry to fastcgi.server for each separate Trac instance that you wish to run.

Relaunch lighttpd, and browse to http://server/trac/ to access Trac.


See also TracGuide, TracInstall, TracMultipleProjects

Note: See TracWiki for help on using the wiki.