Installing Mercurial with nginx and uWSGI

Nicolas Doye
May 16, 2018 · 1 min read

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.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch

Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore

Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade

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