18 messages in ru.sysoev.nginxRe: Running Mercurial using Nginx as ...
FromSent OnAttachments
ThomasJan 26, 2008 9:26 am 
Cliff WellsJan 26, 2008 11:14 am 
Adrian PerezJan 27, 2008 5:29 pm 
ThomasJan 29, 2008 2:58 am 
Marcin KasperskiJan 29, 2008 3:49 am 
ThomasJan 29, 2008 1:11 pm 
eliottJan 29, 2008 1:27 pm 
ThomasJan 29, 2008 1:34 pm 
ThomasJan 29, 2008 2:03 pm 
Manlio PerilloJan 29, 2008 2:30 pm 
ThomasJan 29, 2008 2:47 pm 
ThomasJan 29, 2008 3:23 pm 
ThomasJan 30, 2008 4:57 am 
Manlio PerilloJan 30, 2008 5:47 am 
ThomasJan 30, 2008 6:01 am 
ThomasJan 30, 2008 6:33 am 
Manlio PerilloJan 30, 2008 7:16 am 
ThomasMar 17, 2008 5:23 am 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Re: Running Mercurial using Nginx as http serverActions...
From:Thomas (iamk@public.gmane.org)
Date:Jan 29, 2008 2:58:19 am
List:ru.sysoev.nginx

Hi Adrian

Thanks for your assistance. I will postpone nginx+mercurial to next week, I currently have some other stuff to work on. But I will definitely make it work using your guidelines. Also here is the documentation page from nginx about mod_swgi: http://wiki.codemongers.com/NginxNgxWSGIModule

I post it here for later reference.

On Jan 28, 2008 2:30 AM, Adrian Perez <adrianperez-N/zKP8@public.gmane.org>
wrote:

El Sat, 26 Jan 2008 11:14:55 -0800 Cliff Wells <clif@public.gmane.org> escribió:

On Sat, 2008-01-26 at 18:27 +0100, Thomas wrote:

Hi,

I am having some troubles getting Mercurial (the distributed Version Control System) to work with nginx. It uses a cgi script (hgweb.cgi) to launch mercurial which is a python program.

I'd recommend not using CGI. There are other ways to deploy Mercurial (as a quick Google search will tell you).

I would go for mod_wsgi. There is a wiki page which show how to set-up Apache (http://www.selenic.com/mercurial/wiki/index.cgi/mod_wsgi), and I has been able of setting up a test repository served with Nginx using Manlio Perillo's mod_wsgi for Nginx.

First, do some version control with Mercurial:

$ mkdir /tmp/hg-test && cd /tmp/hg-test && hg-init $ echo 'Hello world' > readme.txt $ hg add readme.txt && hg ci -m'Test commit'

Cast some magic words in the Nginx configuration file:

include wsgi_vars location / { wsgi_pass /tmp/hg-test.wsgi; }

Create /tmp/hg-test.wsgi with the following contents:

from mercurial.hgweb.hgwebdir_mod import hgwebdir from mercurial.hgweb.request import wsgiapplication application = wsgiapplication(lambda:hgwebdir("/tmp/hgwebdir.config"))

Finally, create /tmp/hgwebdir.config, contents should look like the following:

[web] style = gitweb [collections] /tmp = /tmp

(Re)Start Nginx and point your browser to the webserver... hgweb should appear in front of you :D

Of course, you should adjust paths to your particular setup, I used /tmp for testing, but it is *not* a safe setting!

Regards,

-Adrian