2

Running tracd and accessing its web directly works fine.

However, I want it sitting behind nginx, accessible by going to example.com/trac/.

To that end, I've made the following change to the nginx configuration:

location /trac/ {
    proxy_pass http://127.0.0.1:3456/; # tracd listens there
    proxy_redirect default;
    proxy_set_header Host $host;
}

Visiting example.com/trac/ now shows me a broken Trac homepage, where none of the CSS, JS or image files get loaded because all of those other requests get sent to something like example.com/css, instead of example.com/trac/css.

How can I fix this?

How do I make Trac realize it's in example.com/trac/, and not example.com/?

Thanks!

Edit: I've set the following trac.ini settings and restarted tracd, but the problem persists:

base_url = https://example.com/trac/
use_base_url_for_redirect = true
liszt
  • 151
  • 1
  • 7

1 Answers1

3

It seems defining base_url and use_base_url_for_redirect no longer works.

Instead, use the --base-path option when running tracd directly.

So now I run tracd like this:

tracd /path/to/trac/dir --base-path=trac

And the nginx conf becomes simpler:

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

This seems to work.

liszt
  • 151
  • 1
  • 7