[CentOS] Can't get .htaccess to work

Sat Apr 19 14:16:54 UTC 2008
Jim Perrin <jperrin at gmail.com>

On Sat, Apr 19, 2008 at 8:56 AM, Pam Astor <pamastor at hotmail.com> wrote:

> >For my httpd.conf, I have one main configuration file in /etc/httpd/conf
> and for each virtual domain, I have individual
> >www.mydomain.com.conf files with associated virtual host tags inside, and
> located in /etc/httpd/conf.d directory.

Okay. These are vhost configs only. You *can* set them globally in
httpd.conf, but they can be overwritten later, so it's best to do it
vhost by vhost.

> >
> >I also tried placing the AllowOverride AuthConfig directive inside the
> individual conf.d virtual domain
>  >files but then apache would not reload, so I took them out and reloaded
> again.

This depends on where within the vhost config you put them. Apache
should tell you exactly what line of the config the error is on, and
what exactly is wrong with it.

> >Are the individual conf.d files causing the problem?

Only because they aren't formatted properly.

> <Location /secure>
> AuthType basic
> AuthName "private area"
> AuthBasicProvider file
> AuthDBMUserFile /home/maindir/.htpasswd
> Require valid-user
> </Location>

This one is wrong because you're pointing a DBM statement to a flat
user file which isn't in dbm format.

> <Location /secure>
>  AuthType basic
>  AuthName "private area"
>  AuthBasicProvider file
> Require valid-user
>  </Location>

This one sets the auth type outside everything else, and provides
multiple names.

> AuthUserFile /home/maindir/.htpasswd
> AuthType Basic
> AuthName "My Secret Folder"
> Require valid-user

Here's a statement that I know works, from my nagios setup at home,
altered for what you're looking to do.

<Directory "/change/this">
   Options None
   AuthName "Nagios Access"
   AuthType Basic
   AuthUserFile /etc/httpd/htpasswd.users
   Require valid-user

During times of universal deceit, telling the truth becomes a revolutionary act.
George Orwell