nginx + fossil configuration problem

Francis Daly francis at
Wed Nov 21 22:43:27 UTC 2012

On Wed, Nov 21, 2012 at 10:44:11PM +0100, Monthadar Al Jaberi wrote:

Hi there,

> I think I got it to work using rewrite.

I think you are bypassing nginx. That's fine if you want to; but in that
case you could have just gone to fossil directly in the first place.


If you see "8080" in your browser bar, you're not using nginx.

> location /fossil {

Change that to "location /fossil/ {" or (better) "location ^~ /fossil/ {"

>             rewrite /fossil/(.*) /$1 break;

Remove that.

>             proxy_pass http://localhost:8080;
>             proxy_redirect off;
>             proxy_set_header Host $host:$proxy_port;

Change that back to "proxy_set_header Host $host;"

>             proxy_set_header X-Real-IP $remote_addr;
>             proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

I don't think those lines make any difference to fossil. It's clearer
to remove them, too.

>         }
> I hope this is a sane solution :)

I don't think that it will work from off your own server.

If it does what you want, then it is good enough. But I think that when
you test from another machine, you will see a problem.

Even after you put it back the way it was, you still will not see it work
cleanly, because your fossil is not configured to be reverse proxied at
a different url. By that, I mean: you request http://server/fossil/aaa,
but fossil returns links and redirections assuming that you requested
http://server/aaa (which, as far as fossil is concerned, you did).

The current way to adjust fossil to be reverse proxied at a different
place in the url hierarchy seems to be to start it like

  SCRIPT_NAME=/fossil fossil server /path/to/fossils/

(and that means that you won't be able to access it directly at

Francis Daly        francis at

More information about the nginx mailing list