Here's how I set up Trac on this server...

  • Gentoo Linux
  • Apache 2.0.5x
  • Python 2.3.4
  • mod_python 3.1.3
  • Trac - from trunk (currently r1280)

Apache Conf

lots of layers, with includes, but the relevant vhost is trac.dsource.org.conf in the vhosts directory:

Alias /trac/ "/usr/share/trac/htdocs/"

<VirtualHost *:80>

        ServerName trac.dsource.org
        ServerAlias
        Setenv VLOG
        DocumentRoot /var/www/dsource.org/prod
        DirectoryIndex index.php

        <Directory /var/www/dsource.org/prod>
                Options Indexes FollowSymLinks
                AllowOverride None
                Order allow,deny
                Allow from all
        </Directory>

        <Directory "/usr/share/trac/htdocs/">
          Options -Indexes MultiViews
          AllowOverride None
          Order allow,deny
          Allow from all
        </Directory>

        <Location /projects>
          SetHandler mod_python
          PythonHandler trac.ModPythonHandler
          PythonOption TracUriRoot /projects
          PythonOption TracEnvParentDir "/var/trac"
        </Location>

        <LocationMatch /projects/[[:alnum:]]+/login>

                AuthType Basic
                AuthName "dsource-Trac"

                Auth_PG_host localhost
                Auth_PG_port 5432
                Auth_PG_database dsource
                Auth_PG_user dsource
                AUTH_PG_pwd ****************

                Auth_PG_pwd_table users
                Auth_PG_uid_field username
                Auth_PG_pwd_field password
                Auth_PG_encrypted off

                Auth_PG_grp_table groups
                Auth_PG_grp_user_field username
                Auth_PG_grp_group_field groupname

                Require valid-user

        </LocationMatch>

</VirtualHost>

You may want to ignore the Auth_PG stuff, as I'm using mod_auth_pgsql to authenticate against a Postgres database.

As for the menus on the left side (it was wiped when I did an upgrade) here's how, using an example from Edgewall:

  1. site_header.cs
    <style type="text/css">
     #left {
      position: absolute;
      top: 200px;
      left: 10px;
      z-index: 1;
      width: 120px;
      font-size: x-small;
     }
    
     #left ul {
      list-style-image: url(/gfx/li_arr1.png);
      margin-left: 0;
      padding-left: 30px;
     }
    
     #left ul li { margin: 1em 0; padding: 0; }
    </style>
    
    <div id="left">
      <div class="block">
       <ul>
        <li><a href="/trac/">Home</a></li>
        <li><a href="/trac/wiki/TracDownload">Download</a></li>
        <li><a href="/trac/wiki/TracGuide">Documentation</a></li>
        <li><a href="/trac/wiki/TracFaq">FAQ</a></li>
        <li><a href="/trac/wiki/TracSupport">Support</a></li>
        <li><a href="/trac/wiki/HowToContribute">Participate</a></li>
        <li><a href="/trac/wiki/MailingList">Mailing Lists</a></li>
        <li><a href="http://www.edgewall.com/contact/">Feedback</a></li>
       </ul>
      </div>
     </div>
    

This is simplified. Usually, I'd have a site_css.css file hanging around and separate the markup from the styles.