Configuring hgwebdir.cgi and Apache
Mads Kiilerich
mads at kiilerich.com
Tue Jan 4 05:02:52 CST 2011
On 01/04/2011 03:33 AM, hjazz6 wrote:
>
> Hi,
>
> I'm using Mercurial 1.7 and Apache 2.2.3. I'm trying to use the hgwebdir.cgi
> script to authenticate and serve my repositories, which are located at
> /var/lib/mercurial-server/repos.
>
> Although the authentication works, the webpage does not show any of the
> repositories.
>
> This is my /var/www/cgi-hg/hgwebdir.cgi:
>
> config = "/var/lib/mercurial-server/repos/"
> import sys; sys.path.insert(0, "/usr/lib64/python2.4/")
> import cgitb; cgitb.enable()
>
> from mercurial import demandimport; demandimport.enable()
> from mercurial.hgweb import hgweb, wsgicgi
> application = hgweb(config)
> wsgicgi.launch(application)
>
>
> This is my /var/www/cgi-hg/hgwebdir.config:
>
> [collections]
> /var/lib/mercurial-server/repos=/var/lib/mercurial-server/repos
>
> [web]
> allow_push = *
> style = gitweb
> push_ssl = False
>
>
> This is my /etc/httpd/conf/httpd.conf (parts where changes were made):
>
> DocumentRoot "/var/www/cgi-hg"
>
> <Directory />
> Options ExecCGI FollowSymLinks
> AllowOverride None
> Order allow,deny
> Allow from all
> </Directory>
>
> <Directory "/var/www/cgi-hg">
> Options ExecCGI Indexes FollowSymLinks
> AllowOverride None
> </Directory>
http://mercurial.selenic.com/wiki/PublishingRepositories#Publishing_the_CGI_script_directly
do tell the full story. ScriptAlias is enough and you don't need this.
> DirectoryIndes index.html index.html.var hgwebdir.cgi
typo - but also not relevant.
> ScriptAlias /hg "/var/www/cgi-hg/hgwebdir.cgi"
>
> <Location /hg>
> AuthType Basic
> AuthName "Login Required"
> AuthUserFile /usr/local/etc/users
> Require valid-user
> </Location>
Try to get it working without authentication first.
> Using config = "/var/lib/mercurial-server/repos/"
With a trailing slash?
> and config =
> "/var/hg/hgwebdir.config" in hgwebdir.cgi gives me the empty repository
> page. Even though there is NO hgwebdir.config in /var/hg/.
Should be fixed in 1.7.3 - http://selenic.com/repo/hg/rev/5bcb6c9d16db
> Using config = "/var/www/cgi-hg/hgwebdir.config" gives me a page showing
> OSError. Part of the page shows:
>
> /var/www/cgi-hg/hgwebdir.cgi
> (highlighted) 22 application = hgweb(config)
> application undefined, hgweb =<function hgweb>, config =
> '/var/www/cgi-hg/hgwebdir.config'
>
> /usr/lib64/python2.4/site-packages/mercurial/hgweb/__init__.py in
> hgweb(config='/var/www/cgi-hg/hgwebdir.config', name=None, baseui=None)
> (highlighted) 26 return hgwebdir_mod.hgwebdir(config, baseui=baseui)
> ...
Please provide the full output.
> I also noticed that whenever I restart my httpd, I get the 2 messages:
> Starting httpd: [date time] [warn] The ScriptAlias directive in
> /etc/httpd/conf/httpd.conf at line 570 will probably never match because it
> overlaps an earlier ScriptAliasMatch.
...
> There is no ScriptAliasMatch in my httpd.conf.
I'm sure there is a reason Apache gave that message, and the reason is
not in Mercurial but in your Apache configuration.
> When I point my browser to<IP address>/hg, I'm asked to authenticate, then
> I either get the empty repository page, or the Python errors, depending on
> which config I use in the hgwebdir.cgi.
>
> If I use "hg serve --webdir-conf /var/www/cgi-hg/hgwebdir.config", all my
> repositories show up correctly.
>
> I'm very new to apache, so I'm sure I've gotten something wrong. Please
> advise.
>
> Thank you.
The real reason might be file system permissions. See
http://mercurial.selenic.com/wiki/PublishingRepositories#Troubleshooting
/Mads
More information about the Mercurial
mailing list