Installing Mercurial with nginx and uWSGI

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:

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



Person of UNIX descent.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store