Neither the Wiki nor the Schimpf book explain how to set up a Fossil server 
behind a reverse proxy, and a lot of the nginx reverse proxy methods given 
online don’t work correctly with Fossil.

After a lot of semi-random flailing, I managed to hit on the magic combination, 
so I thought I’d post the method here, for my future self if nothing else.

First, start Fossil in “server” mode:

    $ fossil server --localhost --port 12345 \
      --baseurl http://your.web.site/code \
      /full/path/to/repo.fossil &

--localhost is important because we don’t want outsiders to connect to Fossil 
directly.  Outsiders must go through the reverse proxy.

For the --port, I didn’t actually use 12345, I went to random.org and had it 
pick a port between 1024 and 49151, that being the range that is fairly safe to 
use for ad hoc TCP servers.

--baseurl seems to be a relatively new feature to Fossil, which is what makes 
this possible.  Basically, we’re saying that the repo lives under /code in our 
web site’s URL scheme.

Once it’s running in the background, add this to your nginx configuration, 
within the server {} block:

    location /code/ {
        proxy_pass http://localhost:12345/;
    }

This block tells nginx that accesses to http://your.web.site/code/* get sent to 
port 12345 on the local machine.  Since both nginx and fossil know about the 
/code path, neither side has to do any URL rewriting, unlike with the SCGI 
method.

Both the trailing slashes are critically important.  If you leave either off, 
you get an endless redirect loop.
_______________________________________________
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users

Reply via email to