set part of path as variable

Joseph Jacobs hazardcell at gmail.com
Fri May 1 17:33:51 MSD 2009


Hey guys,

I'm trying to configure trac with nginx. I'm using nginx_auth_mysql to
authenticate trac users against a mysql database so I have to use FCGI to
call trac instead of a proxy pass to tracd. The problem I'm having with this
setup is that I have to add a location for each trac repository if I want
them to work. I've been trying to find a workaround for this. Here's what I
have so far.

        server_name    trac.joejacobs.org;

        location ~ ^/(.*)/login {
            auth_mysql_realm "Trac Login";
            auth_mysql_host "localhost";
            auth_mysql_user "db_user";
            auth_mysql_password "db_pass";
            auth_mysql_database "db_name";
            auth_mysql_table "db_user_table";
            auth_mysql_password_column "db_user_pass";
            auth_mysql_user_column "db_user_name";
            auth_mysql_encryption_type "md5";

            fastcgi_param       REMOTE_USER        $remote_user;
            fastcgi_param       TRAC_ENV
/path/to/trac/repos/project;
            fastcgi_param       SCRIPT_NAME          /pytwit;
            include                 trac_fcgi.conf;
        }

        location ~ ^/(.*) {
            fastcgi_param       TRAC_ENV
/path/to/trac/repos/project;
            fastcgi_param       SCRIPT_NAME         /project;
            include                 trac_fcgi.conf;
        }

the url for a repository will be http://trac.joejacobs.org/project

I want the project name to be a variable. As you can see I've tried placing
the project path in brackets but that obviously doesn't work. What am I
doing wrong here?

Cheers,
Joe Jacobs
http://joejacobs.org/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://nginx.org/pipermail/nginx/attachments/20090501/343313d2/attachment.html>


More information about the nginx mailing list