Installing Trac on Apache with mod_python

If you are trying to install Trac…

  • … on Apache
  • … with mod_python
  • … in a subdirectory of a Wordpress install
  • … with a virtual host

… then please take a look at these additional directions. The directions I have below are adapted based on those directions found at http://trac.edgewall.org/wiki/TracModPython.

  1. Do not setup Trac for Apache in your httpd.conf. Instead, put it in your sites-available/your_vhost configuration file. That way, the changes only apply to your v-host.
  2. When you use the Location directive for your Apache configuration, remember that the path is the Apache path, not the file system path.
  3. The real problem with Wordpress comes if you are using Permalinks. If this is the case and you are installing Trac in the subdirectory of your Wordpress .htaccess file that does the rewrites for mod_rewrite, you will have to add the additional line in your .htaccess file so that you disable rewrites for your subdirectory:
    RewriteCond %{REQUEST_URI} !^/trac
    

    Therefore, your whole .htaccess should look something like the following:

    Options +FollowSymLinks
    
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_URI} !^/trac
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    

And if you are using Squid, make sure to restart it and wait 60 seconds so cached pages can expire.

Those are some of the mistakes I made (or problems I couldn’t figure out) when installing my Trac. Thanks to Nicholas Reily and wildintellect and coderanger on Trac IRC for helping me out.