It is possible to have more than one trac site on one host.  This article explains how to accomplish this using apache, mod_python, and trac on a Red Hat based system (although the principles easily translate to Ubuntu based systems) so that each of your sites has an address like trac.example.com.

The prerequisites for this article is that you already know how to do a basic installation of subversion, trac, apache, and mod_python or you have a system that has those components already installed.  You will also need access to add some DNS settings for your domain.

The way I like to configure my system is to have most non-generic apache configuration exist in /etc/httpd/conf.d.  So the first file I create is a file that is specific for my trac installations but generic across all the trac sites, general.conf:

#######################
# General configuration
#######################

# For mod_python support

LoadModule python_module modules/mod_python.so
PythonOptimize On

# For trac support

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

Now, for each trac site, I create a file like the following, trac.example.com.conf:

# TRAC FOR EXAMPLE.COM
#######################

<VirtualHost 10.10.0.1>
    ServerName trac.example.com
    ServerAdmin master@example.com
    # DocumentRoot is just a dummy for this site
    DocumentRoot /home/virtual/example.com/webroot/htdocs

    # THIS IS CRITICAL FOR MOD_PYTHON 3.2.8 AND TRAC!!

    PythonInterpreter main_interpreter

    <Location />
        SetHandler mod_python
        PythonHandler trac.web.modpython_frontend
        PythonOption TracUriRoot "/"
        PythonOption TracEnv /opt/example.com/trac
    </Location>
    <Location /login>
        AuthType basic
        AuthName "Trac - Lokl.com Project"
        AuthUserFile "/opt/example.com/ht.passwd"
        Require valid-user
    </Location>
    <Location /trac>
        SetHandler default-handler
    </Location>
</VirtualHost>

Lastly, you will have to go add some new CNAME entries in your DNS to point trac.example.com to your regular web address example.com or your IP address. Most ISPs or hosting companies have nice simple interfaces that makes this step quite easy so I won’t go into it.

After restarting your web server you should now be able to hit trac.example.com and have your trac site appear. Repeat for each trac site you maintain!

 Leave a Reply

(required)

(required)

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">

   
© 2012 rootsmith blog Suffusion theme by Sayontan Sinha