LinuxHappy's Weblog

Failures and Successes of Linux-based Development

Archive for June, 2008

Sucess: svn + apache2 + SSL + ubuntu 7.10/8.04 + users + part 2a: trac massaging

Posted by linuxhappy on June 22, 2008

If you’ve followed parts 1 and 2 from my blog, you’ve gotten up a svn/http+SSL/with users/ plus trac.
So based on the configurations in parts 1 and 2.. to get to your svn website, you access it with:

https://yoursite/svn

And.. to get to your trac site, you can access:

https://yoursite/trac.cgi

Unfortunately, based on my previous config, you CANNOT access:

https://yourIP/trac.cgi
https://yoursite/trac

This is pretty annoying in two places:
1. What if you don’t want to refer to your server with the name? What if the name server is down? Perhaps if you know the IP, it would be cool if you could get to your site without having to use the name ( and modifying the /etc/hosts file.. or perhaps some other way on windows)

2. Who wants to type the “.cgi” as part of “trac.cgi”. Why not just leave it trac? ok.. soo here are my answers to solving both those issues.. Here’s my config for /etc/apache2/sites-available/trac

<VirtualHost *:443>
ServerAdmin webmaster@localhost
ServerName hirame
DocumentRoot /usr/share/trac/cgi-bin/
<Directory /usr/share/trac/cgi-bin/>
Options Indexes FollowSymLinks MultiViews ExecCGI
AllowOverride All
Order allow,deny
allow from all
</Directory>
Alias /tracinfo “/usr/share/trac/htdocs”

<Location /trac.cgi>
SetEnv TRAC_ENV “/var/lib/trac”
</Location>
<Location /trac>
SetEnv TRAC_ENV “/var/lib/trac”
</Location>
Alias /trac “/usr/share/trac/cgi-bin/trac.cgi”
<Location “/”>
AuthType Basic
AuthName “Trac”
AuthUserFile /etc/apache2/dav_svn.passwd
Require valid-user
</Location>

DirectoryIndex trac.cgi
ErrorLog /var/log/apache2/error.trac.log
CustomLog /var/log/apache2/access.trac.log combined
SSLEngine on
SSLCertificateFile /etc/apache2/ssl/apache.pem
SSLProtocol all
SSLCipherSuite HIGH:MEDIUM

</VirtualHost>

<VirtualHost *:443>
ServerAdmin webmaster@localhost
ServerName 10.10.1.132
DocumentRoot /usr/share/trac/cgi-bin/
<Directory /usr/share/trac/cgi-bin/>
Options Indexes FollowSymLinks MultiViews ExecCGI
AllowOverride All
Order allow,deny
allow from all
</Directory>
Alias /tracinfo “/usr/share/trac/htdocs”

<Location /trac.cgi>
SetEnv TRAC_ENV “/var/lib/trac”
</Location>
<Location /trac>
SetEnv TRAC_ENV “/var/lib/trac”
</Location>
Alias /trac “/usr/share/trac/cgi-bin/trac.cgi”
<Location “/”>
AuthType Basic
AuthName “Trac”
AuthUserFile /etc/apache2/dav_svn.passwd
Require valid-user
</Location>

DirectoryIndex trac.cgi
ErrorLog /var/log/apache2/error.trac.log
CustomLog /var/log/apache2/access.trac.log combined
SSLEngine on
SSLCertificateFile /etc/apache2/ssl/apache.pem
SSLProtocol all
SSLCipherSuite HIGH:MEDIUM

</VirtualHost>

So as you can see, to get the http://yoursite/trac working, we basically define another location, and then set an alias to it. Secondly, to get http://yoursite/trac and http://yourIP/trac working at the same time, we haven’t done much more than to just repeat the entire virtual host stanza with a different value for ServerName.

Sweet. simple. easy. Now go to sleep.

Posted in Uncategorized | 2 Comments »