Archives

Trac and SVN on subdomains

Posted in: Tech, Web | Tags: , , ,

I finally figured out how to get trac and svn on their own subdomains since when I originally setup the web server awhile ago. The only thing that changes is the vhosts file. In that example it was “/etc/apache2/sites-available/svntrac”. Here’s what the file should look like now:

NameVirtualHost *:80
<VirtualHost *:80>

ServerAdmin you@domain.com
ServerName domain.com

DocumentRoot /var/www/
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>

ErrorLog /var/log/apache2/error.log
LogLevel warn
CustomLog /var/log/apache2/access.log combined
ServerSignature On
</VirtualHost>

<VirtualHost *:80>
  ServerName svn.domain.com
   <Location />
   DAV svn
   SVNParentPath /svn

   AuthType Basic
   AuthName "Subversion Repository"
   AuthUserFile /path/to/svnauth

<LimitExcept GET PROPFIND OPTIONS REPORT>
   Require valid-user
</LimitExcept>

#   AuthzSVNAccessFile /path/to/svnaccess
  </Location>
</VirtualHost>

<VirtualHost *:80>

   ServerName trac.domain.com

   <Location />

    SetHandler mod_python
    PythonHandler trac.web.modpython_frontend
    PythonOption TracEnvParentDir /trac
    PythonOption TracUriRoot /

   </Location>

   <Location /*/login>

    AuthType Basic
    AuthName "Trac"
    AuthUserFile /path/to/svnauth
    Require valid-user

   </Location>
</VirtualHost>
Jul
19
2009

Comments

  1. [...] thought about doing before, but haven’t taken the time to stop and set it up. After getting sub-domains working, this was a breeze, as it’s the same process. I’m working on an Ubuntu server, so this [...]

  2. hehe says:

    wow this actually worked for my existing install @ /var/lib/trac/project
    i realized that u dont have a doc root
    i gues the doc root here is the python one
    so i was doing both and my apache was runing in a loop which does a 500
    i am not sure about teh /*/login part tho

  3. hehe says:

    o yea almost forgot
    i left my login as /login like it was
    im not sure y ur doing a /*

    • Josh says:

      The /*/login is because this server will be for more than one trac environment. Giving it that wild card means I only have to setup this file once and it will for every trac environment that i setup. If you’re only planning to run one trac environment on your server you can replace the * with the name of your trac instance, but that would be pointless since this way works and makes it more bullet-proof.

Leave a Reply