Installing Mercurial with nginx and uWSGI

Nicolas Doye
1 min readMay 16, 2018

Because some people still use hg.

What do you do if your legacy SCM needs migrating to a new box? You can find a lot of instructions on installing Mercurial, but there are no up-to-date instructions on how to do it with nginx, uWSGI and via a socket.


This is on CentOS 7 with Mercurial 4.5, nginx 1.12.2 and uWSGI 2.0.16 installed via RPM.


A simple, basic auth nginx configuration could look like the following.


Note the UNIX socket for uWSGI. The static files are the location from the mercurial RPM.


A complete configuration for uWSGI would look like the following



Set up your hgweb.configin /var/www/hg. In this set-up, a minimal one would look like:


The, otherwise vanilla,hgweb.wsgi (which also lives in /var/www/hg) needs to refer to that file:

config = "/var/www/hg/hgweb.config"

Now put your repos under /srv/hg/repos and Bob’s your uncle.