Search code examples
apache2trac

Sublocation for Trac on Apache2 web server


I need to put Trac on a URL path other than /. If I take the configuration from http://trac.edgewall.org/wiki/TracOnUbuntu and modify the Location blocks, I get the error message "No handler matched request to /trac". How can I avoid this?

<VirtualHost *:80>
    ServerName trac.local
    <Location /trac> # instead of Location /
       SetHandler mod_python
       PythonInterpreter main_interpreter
       PythonHandler trac.web.modpython_frontend
       PythonOption TracEnv /var/local/trac
       PythonOption TracEnvParentDir /var/local/trac
       PythonOption TracUriRoot /
       PythonOption TracEnv /var/local/trac
        # PythonOption TracEnvIndexTemplate /var/local/trac/templates/index-template.html
       PythonOption TracLocale en_US.UTF8
       PythonOption PYTHON_EGG_CACHE /tmp
       Order allow,deny
       Allow from all
    </Location>
    <Location /trac/login> # instead of /login
      AuthType Basic
      AuthName "myproject"
      AuthUserFile /var/local/trac/.htpasswd
      Require valid-user
    </Location>
</VirtualHost>

Solution

  • How about adjusting 'PythonOption TracUriRoot /' too?

    Furthermore please acknowledge, that mod_python is depreciated (end-of-life), and you should rather choose WSGI for new installations instead.