▄▄             ▄▄▄  ▄▄▄ Power
█  █ ▄▄▄▄ ▄▄▄▄▄ █  █ █  █
█▄▄█ █▄▄▄ █ █ █ █▀▀▄ █▀▀▄
█  █ ▄▄▄█ █ █ █ █▄▄▀ █▄▄▀

/ aa about.it ad amd64 and.who api asm asmbb asmbb.features authentication bbcode best bugs cares chat common debian deck design dll docker email embed fast feature files fossil fresh.ide friendly gamedev heap help hiawatha i18n incredible interop learning libfresh limit links linux mailing.list meme meta.http-equiv minimag money mysql neo nginx numbers orly os outage pass password post-by-email programmers programming proile read-by-email resources safety script.alert.xss secret seo skins sodom source sourcecode subdirectory subforum support tags templates test test123 type very.ugly video work xss игнат котики парола русский тест уеб.програмиране хабр.наполеон
Categories Threads

Setting up fossil on nginx web server RSS

Earlier, I have wrote an article explaining how to setup AsmBB forum with nginx server.

But if you have nginx server up and running you can very easy host fossil managed source code repositories.

Setting up a fossil facility with nginx is very easy and trouble free. I am even wondering why this setup is not documented in details in the fossil documentation.

Of course as a prerequisite you need to have fossil installed. You can do it from your Linux distro package manager, or as long as fossil is a single executable file, simply download it from the fossil web site and place it in /usr/bin directory.

Configuring nginx

At first, you need to choose the URL on which the fossil repositories will be located. If assume that the main web site is located on http://example.com one possible URL for the fossil repositories is http://example.com/fossil/

First, you need to include in the nginx configuration file the new location. It have to be included inside the respective server {} section of the configuration:

# Already existing and working web server configuration server { .... some options ... .... other options ... # This is the fossil configuration you need to include location /fossil/ { scgi_pass; # select whatever free port you want. include scgi_params; # this file is usually scgi_param SCRIPT_NAME "/fossil"; } }

There are in general two types of nginx setup:

The first is "one config file" type, where all server configuration is located in a single file, usually /etc/nginx/nginx.conf. In this case, you need only to look for the proper server {} section if there are more than one.

The second type is "one config file per virtual host" where every virtual host have separate config file, usually located in some subdirectory of /etc/nginx/ directory. In this case, you need to include the fossil configuration in one of these configuration files.

Once the nginx is configured the configuration need to be reloaded with:

sudo systemctrl reload nginx

Configuring fossil scgi service

Fossil can be started manually from the console (especially for tests) but it is better to create a service for systemd in order to make it start automatically on restarts and possible program faults.

Create file /etc/systemd/system/fossil.service with the following content:

[Unit] Description=Fossil scm SCGI script. After=nginx.service [Service] Type=simple User=YOUR_PREFERED_USER WorkingDirectory=/DOCUMENT_ROOT/fossil ExecStart=/usr/bin/fossil server /DOCUMENT_ROOT/fossil/ --scgi --localhost --port 9000 --repolist Restart=on-failure [Install] WantedBy=nginx.service

Creating this file you need to replace the following placeholders:

YOUR_PREFERED_USER is the user you want run fossil script. Notice that this user must have writing access to all repository files. Otherwise fossil will not be able to manage the repositories.

DOCUMENT_ROOT is the directory where your web site is located.

Now enable and start your new fossil service:

sudo systemctl enable fossil sudo systemctl start fossil


From this moment, every repository file REPO_NAME.fossil located in /DOCUMENT_ROOT/fossil directory will be served by fossil on a URL: http://example.com/fossil/REPO_NAME. (Notice the omitted .fossil extension!)

On an URL http://example.com/fossil/ fossil returns a list with links to all served repositories.


AsmBB v2.6 (check-in: f15fadce65c1fa6d); SQLite v3.28.0 (check-in: 884b4b7e502b4e99);

©2016..2018 John Found; Licensed under EUPL.
Powered by Assembly language
Created with Fresh IDE

Icons are made by Egor Rumyantsev, vaadin and icomoon from www.flaticon.com