Serving Over HTTP Using CGI

The simplest way to host one or more repositories in a permanent way is to use a web server and Mercurial’s CGI support.

Depending on how ambitious you are, configuring Mercurial’s CGI interface can take anything from a few moments to several hours.

We’ll begin with the simplest of examples, and work our way towards a more complex configuration. Even for the most basic case, you’re almost certainly going to need to read and modify your web server’s configuration.

High pain tolerance required

Configuring a web server is a complex, fiddly, and highly system-dependent activity. I can’t possibly give you instructions that will cover anything like all of the cases you will encounter. Please use your discretion and judgment in following the sections below. Be prepared to make plenty of mistakes, and to spend a lot of time reading your server’s error logs.

If you don’t have a strong stomach for tweaking configurations over and over, or a compelling need to host your own services, you might want to try one of the public hosting services that I mentioned earlier.

Web Server Configuration Checklist

Before you continue, do take a few moments to check a few aspects of your system’s setup.

  1. Do you have a web server installed at all? Mac OS X and some Linux distributions ship with Apache, but many other systems may not have a web server installed.

  2. If you have a web server installed, is it actually running? On most systems, even if one is present, it will be disabled by default. ...

Get Mercurial: The Definitive Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.