Welcome! Log In Create A New Profile

Advanced

nginx rewrite help for Trac

Posted by bretti44 
nginx rewrite help for Trac
October 16, 2011 12:43AM
I think I'm badly mangling rewrite rules.

I've got a trac installation running behind nginx under a subdomain. The html files for the projects work fine (with a proxy redirect to tracd running on localhost), but I'm having trouble getting static file requests (images, stylesheets, and scripts) to go to the right place.

My directory structure has the projects at /usr/local/bugz/public/[project name] and the static files that are common to all projects rooted at /usr/local/bugz/htdocs/. The requests for the static files come in with a URI that is /[project name]/chrome/common/[blah blah blah], so I've got a location block that looks like this:

location ~ /.+/chrome/common {
rewrite ^/(.+)/chrome/common/(.*)$ /htdocs/$2;
}

The root is set to /usr/local/bugz at the top of the server block and the location block that proxies to tracd is this:

location / {
proxy_pass http://127.0.0.1:8020;
proxy_redirect default;
proxy_set_header Host $host;
}

The nginx log shows that the rewrite isn't working (this is just one file--there are many like this for each page request):

2011/10/15 21:25:57 [error] 96212#0: *601 open() "/usr/local/bugz/bmi./chrome/common/js/folding.js" failed (2: No such file or directory), client: 69.207.32.238, server: issues.brettmingalls.com, request: "GET /bmi./chrome/common/js/folding.js HTTP/1.1", host: "issues.brettmingalls.com", referrer: "https://issues.brettmingalls.com/bmi."

I'm probably making a really stupid n00b mistake. Can anyone help?
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 244
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready