Here’s is an example of how to deploy trac under nginx. I assume that you already have trac installed.
server {
listen 192.168.1.1:80;
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_pass http://127.0.0.1:8000;
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 127.0.0.1 --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