1

I am trying to setup nginx with a reverse proxy to tracd, however I only want to use 1 tracd.

Now first here's my config for this domain

server {
    listen   80;
    server_name bugs.XXXXXXXX.com;

    access_log  /var/log/nginx/XXXXXXXX-bugtracker.access.log proxy;

    location / {
        rewrite ^/bugtracker/(.*)$ /$1;
        rewrite ^/bugtracker$ /;
        proxy_pass http://127.0.0.1:81/bugtracker/;
        proxy_redirect default;
        proxy_set_header Host $host;
    }

    location ~ /\.ht {
        deny  all;
    }
}

As you can see there's the rewrite rules, because for some reason all the urls that tracd spews out are like /bugtracker/something.

Now this is indeed caused by tracd just sending urls like it normally should however trac is at bugs.XXXXXXXX.com/ and not at bugs.XXXXXXXX.com/bugtracker. So how can I make tracd/trac display the (In this case) correct urls ?

Not Available
  • 246
  • 1
  • 15

3 Answers3

1

At work we have a project environment with lots of trac instances (each of them running as different user), so we can't afford to have WSGI processes running for all of them at the same time. Thus, i setup many apache+itk+suexec+fastcgi virtualhosts as the nginx proxy upstreams (each project has 1 virtualhost for trac and 1 virtualhost for svn).

We don't want to add 1 location in nginx for each trac and svn instance, so after spending several days fighting nginx proxy directives with regexes i found that there's a couple of options in trac.ini (since 0.10.5) that can be used to change the default redirect location.

In your case it should have been something like this:

base_url = http://bugs.XXXXXXXX.com/
use_base_url_for_redirect = True

And then the apache redirects (or tracd redirects in your case), should point to the public project URL, not trac default.

See http://trac.edgewall.org/wiki/TracIni for the more details.

alexm
  • 491
  • 1
  • 4
  • 5
0
location / {

        proxy_pass http://127.0.0.1:81/;
        proxy_redirect default;
        proxy_set_header Host $host;
    }
A M
  • 158
  • 8
0

I have switched to using the built in WSGI server as that is intended for a production environment and tracd is not.

it works fine and don't have the above issue that I would have with tracd.

Not Available
  • 246
  • 1
  • 15