Forum: NGINX set part of path as variable

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Ff50771ff432934c6b2de414987b3035?d=identicon&s=25 Joseph Jacobs (Guest)
on 2009-05-01 15:45
(Received via mailing list)
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/
3677ecff935f256e78cb02f557ba15a6?d=identicon&s=25 Joe Jacobs (Guest)
on 2009-05-01 15:48
(Received via mailing list)
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/
This topic is locked and can not be replied to.