How to configure basic authentication in Apache httpd virtual hosts?

Posted by Jader Dias on Server Fault See other posts from Server Fault or by Jader Dias
Published on 2010-03-30T14:50:24Z Indexed on 2010/03/30 14:53 UTC
Read the original article Hit count: 608

I'm trying to configure mercurial access using Apache http. It requires authentication. My /etc/apache2/sites-enabled/mercurial looks like this:

NameVirtualHost *:8080

<VirtualHost *:8080>
    UseCanonicalName Off
    ServerAdmin  webmaster@localhost
    AddHandler cgi-script .cgi
    ScriptAliasMatch ^(.*) /usr/lib/cgi-bin/hgwebdir.cgi/$1
</VirtualHost>

Every tutorial I read on the internet tells me to insert these lines:

AuthType Basic
AuthUserFile /usr/local/etc/httpd/users

But when I do it I get the following error:

# /etc/init.d/apache2 reload
Syntax error on line 8 of /etc/apache2/sites-enabled/mercurial:
AuthType not allowed here

My distro is a customized Ubuntu called Turnkey Linux Redmine

© Server Fault or respective owner

Related posts about httpd

Related posts about apache2