[clo-devel] Finding out how to set up Trac on fastcgi

Erik Huelsmann ehuels at gmail.com
Thu Mar 11 22:18:39 UTC 2010


Hi,

Just finished making the change. c-l.net is now running its Trac on
mod_fastcgi. The only surprise I met was that c-l.net is running
Apache 1.3, not 2.0 as I thought.

On Sun, Mar 7, 2010 at 10:27 PM, Erik Huelsmann <ehuels at gmail.com> wrote:
> Since we seem to have lots of issues with our Trac install (most
> people find it slow; some find its availability disappointing), I
> thought I'd look at the Trac website to find out how their dev team
> advises on these matters. Well, the conclusion is simple: we're using
> the 'tracd' method of running Trac and this is certainly the only way
> how *not* to do it.
>
> They advise CGI for small sites or FastCGI/WSGI for larger sites. I
> estimate us to be in the latter category, so I took my own VPS (which
> is in the former category, but also runs Trac) and configured it for
> FastCGI. The steps turn out to be quite simple. I volunteer to make
> the same changes on c-l.net (which drewc already set me up for), but
> I'm posting here for review. The last thing I'd want is to open up a
> security hole in the site.
>
> Steps are:
>
>  * Install mod_fcgid (although I used mod_fastcgi, which is older and
> not recommended by the Trac team; it works though)
>  * Add the script handlers and the script alias to the httpd.conf file
> within the virtual host section for trac.c-l.net:
>
>  AddHandler fastcgi-script .fcgi
>  ScriptAlias / /path/to/apache/cgi-bin/trac.fcgi/
>
>  * copy the 'web/' subdir of the installed Trac into the cgi-bin directory
>  * copy in the cgi-bin directory "fcgi_frontend.py" to "trac.fcgi"
>  * add to the trac.fcgi script - before the first 'import' statement:
>
>  import os
>  os.environ['PYTHON_EGG_CACHE'] = "/tmp/httpd-egg-cache"
>  os.environ['TRAC_ENV_PARENT_DIR'] = "/path/to/parent/trac/project/dirs"
>
>  * create /tmp/httpd-egg-cache with the user and group used to run
> httpd and '700' access settings

I didn't create directory in /tmp, but in /cache instead.

>  * restart apache

Note that there's an error in the Trac documentation regarding the
configuration of Digest authentication: while the section for
configuration of Digest auth lists the Apache directive
"AuthUserFile", it should have listed "AuthDigestFile". The directive
takes the same parameters, but applies to a different module: the
former applies to the Basic auth module.

I had to add mod_digest to the apache configuration too, however that
was pre-installed, just like mod_fastcgi, so no additional packages
had to be retrieved.

That's about it. Oh, given the current performance drewc and I decided
against installing a robots.txt: the performance is good enough for
now, it looks.


Bye,

Erik.




More information about the clo-devel mailing list