[nginx] Running Mercurial using Nginx as http server
    Adrian Perez 
    adrianperez at udc.es
       
    Mon Jan 28 04:30:06 MSK 2008
    
    
  
El Sat, 26 Jan 2008 11:14:55 -0800
Cliff Wells <cliff at develix.com> 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
-- 
All dwarfs have beards and wear up to twelve layers of clothing.
Gender is more or less optional.
        -- (Terry Pratchett, Guards! Guards!)
    
    
More information about the nginx
mailing list