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.
Introduction
This is on CentOS 7 with Mercurial 4.5, nginx 1.12.2 and uWSGI 2.0.16 installed via RPM.
nginx
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.
uWSGI
A complete configuration for uWSGI would look like the following
hgweb
Set up your hgweb.config
in /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.