AsmBB
Login
Register
/ adamd64asmasmbbbestchatcommondebiandeckdesigndllfastfossilgamedevheaphiawathaincredibleinteroplearninglibfreshlinkslinuxmememeta.http-equivmoneyneonginxorlyospasspasswordprogrammersprogrammingresourcesscript.alert.xsssecretseoskinssodomsourcesourcecodetestworkxssигнаткотикипароларусскийтестуеб.програмиранехабр.наполеон
Categories Thread list

Setting up fossil on nginx web server

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.

1. 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 127.0.0.1:9000; # 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

2. 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

3. Operation

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.

Enjoy!

AsmBB v2.3 (check-in: 60daad368eda26ff)
©2016 John Found; Licensed under EUPL.
Powered by Assembly language and SQLite.
Created with Fresh IDE

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