Installer Trac sous FreeBSD

23 May 2008

Pour se conecter à une base MySQL :

     mysql://username:password@localhost/database
#! /usr/local/bin/python

import os
os.environ['TRAC_ENV'] = "/home/trac/project01"

from flup.server.fcgi import WSGIServer
from trac.web.main import dispatch_request

def application(environ, start_request):
    environ['PATH_INFO'] = environ['SCRIPT_NAME'] + environ['PATH_INFO']
    environ['SCRIPT_NAME'] = ''
    return dispatch_request(environ, start_request)

if __name__ == '__main__':
    WSGIServer(application).run()
$HTTP["host"] =~ "^(www.)?trac.mywebsite.net {
    server.document-root = "/home/trac/project01/"
    alias.url  = ("/trac_prefix/chrome/common/" => "/home/trac/project01/htdocs/")
    url.rewrite-final = ("^/trac_prefix/[^/]+/chrome/common/(.*)" => "/trac_prefix/chrome/common/$1")
    $HTTP["url"] =~ "^/trac_prefix/chrome/" {
        # no fastcgi
    } else $HTTP["url"] =~ "^/" {
        fastcgi.server = (
            "/" => (
                (
                    "bin-path" => "/home/trac/project01/trac.fcgi",
                    "socket" => "/tmp/trac-fastcgi.socket",
                    "check-local" => "disable",
                    "disable-time" => 1,
                    "min-procs" => 1,
                    "max-procs"  => 1,
                    "bin-environment" => (
                        "TRAC_ENV" => "/home/trac/project01/",
                    ),
                ),
            ),
        )
    }
    accesslog.filename = "/var/logs/access-trac.log"
}
$HTTP["host"] =~ "^(www.)?trac.mywebsite.net {
    [...]
    auth.backend  = "htpasswd"
    auth.backend.htpasswd.userfile = "/home/trac/project01/conf/trac.passwd"
    auth.require = (
        "/login" => (
        "method" => "basic",
        "realm" => "Project 01",
        "require" => "valid-user"
        )
    )
}