WebNull

Dec 31 2009

Installing Mercurial hgwebdir.cgi on Windows 2003 IIS 6.0

This walk-through is based on the following stackoverflow article.

  1. Download and install Python 2.6.4 to C:\Mercurial\Python
  2. Download and install MiniGW 5.1.6
    • Choose the Download and Install Option.
    • Choose the Current Package Option to Install.
    • For the Components to Install Select the “Minimal” option. Install to C:\Mercurial\MinGW
  3. Add to path “C:\Mercurial\Python\Scripts;C:\Mercurial\Python;C:\Mercurial\MinGW\bin”
  4. Download and unzip Mercurial source to C:\Mercurial\Source
  5. Build Mercurial from command line:
    python setup.py build --force -c mingw32
    
    python setup.py install --force --skip-build
  6. Create default hgrc from command line type:
    cd %userprofile% 
    copy con .hgrc [ui]
    username = Firstname Lastname <firstname.lastname@example.net>
    verbose = True
    • CTRL-Z
    • ENTER
  7. hg debuginstall should display “No problems detected”
  8. Create C:\Mercurial\Web and C:\Mercurial\Repositories directories
  9. Copy the hgwebdir.cgi file from the C:\Mercurial\Source to C:\Mercurial\Web
  10. Create hgweb.config in C:\Mercurial\Web
  11. Insert text in hgweb.config
    [paths]
    / = C:\Mercurial\Repositories\
  12. Give IUSR_{ComputerName} Modify permissions for C:\Mercurial\Repositories
  13. Create a test repository
    cd C:\Mercurial\Repositories
    md test
    cd test
    hg init
  14. Enable push for this repository
    • create hgrc file with notepad in cd C:\Mercurial\Repositories\test.hg
    • insert the following text
    [web]
    allow_push = *
    push_ssl = false
  15. Start IIS Manager
    • Allow All Unknown CGI Extensions in Web Server Extensions.
    • Create virtual dir or new website with C:\Mercurial\Web path.
    • Grant website execute permission
    • In application configuration (Home Directory, Configuration button) add new extension. Executable:
      "C:\Mercurial\Python\python.exe" %s
      Extension:.cgi
  16. Test your newly configured website: eg. http://localhost/hgwebdir.cgi

TODO:

  • Don’t forget to configure authentication.
  • Change file system permissions accordingly.
  • Increase cgi timeout
cd \inetpub\AdminScripts\
cscript adsutil.vbs GET /W3SVC/CGITimeout
cscript adsutil.vbs SET /W3SVC/CGITimeout 3000
    Page 1 of 1