LinuxHappy's Weblog

Failures and Successes of Linux-based Development

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.

Advertisements

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

  1. Chris said

    hello,
    I followed your guide on setting up svn+trac on an ubuntu 8.04 x86 box and everything is ok.
    what I want to do now is exactly what you wrote here: to have svn in http://server and trac via http://servers/trac BUT the problem is that after I followed this post, I get the error.
    If you could please answer me to this I would really appreciate it!
    many tks!
    keep up the good work,
    Chris

    Oops…

    Trac detected an internal error: [Errno 2] No such file or directory: ‘./var/lib/trac./VERSION’

    Traceback (most recent call last):
    File “/usr/share/trac/cgi-bin/trac.cgi”, line 20, in
    cgi_frontend.run()
    File “/var/lib/python-support/python2.5/trac/web/cgi_frontend.py”, line 68, in run
    gateway.run(dispatch_request)
    File “/var/lib/python-support/python2.5/trac/web/wsgi.py”, line 87, in run
    response = application(self.environ, self._start_response)
    File “/var/lib/python-support/python2.5/trac/web/main.py”, line 391, in dispatch_request
    env = _open_environment(env_path, run_once=run_once)
    File “/var/lib/python-support/python2.5/trac/web/main.py”, line 51, in _open_environment
    return open_environment(env_path)
    File “/var/lib/python-support/python2.5/trac/env.py”, line 462, in open_environment
    env = Environment(env_path)
    File “/var/lib/python-support/python2.5/trac/env.py”, line 147, in __init__
    self.verify()
    File “/var/lib/python-support/python2.5/trac/env.py”, line 195, in verify
    fd = open(os.path.join(self.path, ‘VERSION’), ‘r’)
    IOError: [Errno 2] No such file or directory: ‘./var/lib/trac./VERSION’

  2. Chris said

    ah, please ignore the previous reply. not sure how it happened that I was copy/paste between your post and the putty window with the connection to the server and the ” ” it was pasting up like dots instead of “…
    weird but once I discovered that, everything worked like a charm… the same like the full tutorial that you put head to head for svn-trac-ubuntu.
    many thanks again!
    really appreciate your work on this.
    Chris

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: