after trying to enable mercurial apache web access on my Ubuntu Server 12.04 box, I've got a 403 Forbidden error when accessing http://my.site.com/mercurial with log:
[Tue Sep 04 01:20:22 2012] [error] [client X.X.X.X] client
denied by server configuration: /mercurial/hgweb.cgi
I have added this to /etc/apache2/sites-available/default
ScriptAliasMatch ^/mercurial(.*) /mercurial/hgweb.cgi$1 <Directory /var/www/mercurial> Options Indexes FollowSymlinks MultiViews ExecCGI Options None AllowOverride All Order allow,deny Allow from all AuthType Basic AuthName "Repositorio Mercurial" AuthUserFile /mercurial/hgusers Require valid-user </Directory>
This is strange, but apache does't asks me for password when trying to access the web server folder
[web]
style = gitweb
[collections]
/mercurial/repositories = /mercurial/repositories
/mercurial/hgwebconfig.cgi (on filesystem)
config = "/mercurial/hgweb.config"
I have linked /mercurial to /var/www/mercurial
Any advise will be really appreciated.
Thanks
Best Answer
Since you're using
/mercurial
(on the filesystem) as your script root, you need your authorization configuration there instead of on/var/www/mercurial
, despite the fact that/mercurial
symlinks to/var/www/mercurial
. From the documentation of theOptions
directive:So, move your access controlling
<Directory>
block to be for/mercurial
- and you'll need aFollowSymLinks
on/
as well. (By the way, why does it haveOptions None
right after the otherOptions
directive?)The symlink is making this a lot more complicated and confusing than it needs to be - I'd really recommend getting rid of that and using the
/var/www/mercurial
filesystem path, which will greatly simplify the situation.