01 Feb

trac deployment under nginx on Centos 6

Here’s is an example of how to deploy trac under nginx. I assume that you already have trac installed.

server {
    server_name trac.example.com www.trac.example.com default;

    location /chrome/common/ {
         alias /usr/lib/python2.6/site-packages/trac/htdocs/;
         expires 1M;
         add_header Cache-Control private;
         gzip_static on;
         gzip_disable Firefox/([0-2]\.|3\.0);
         gzip_disable Chrome/2;
         gzip_disable Safari;
    location / {
        auth_basic            "Authorized area";
        auth_basic_user_file  /home/trac/.passwords;

        proxy_set_header REMOTE_USER $remote_user;

trac is being launched this way:

/usr/bin/python /usr/sbin/tracd --daemonize --pidfile=/tmp/tracd.pid --port=8000 --protocol=http --single-env /home/trac -b --basic-auth==/home/trac,/home/trac/.passwords,example.com

To get the authorization working you should also have this parameter in your trac.ini file:

obey_remote_user_header = true

Leave a Reply

Your email address will not be published. Required fields are marked *