I need to password protect an Apache subdir with HTTP authentication of some kind. I don't really care if it's basic auth or MySQL auth. I just need to keep the public from being able to see a specific subdir of a public site.
My server OS is Ubuntu Server. I've tried posting to their forums, but that didn't help much. I've tried a few things already, but basically, when I think I've done it correctly, I get an HTTP auth dialog, enter the correct user/pass, and I get:
Code:
Unauthorized
This server could not verify that you are authorized to access the document requested. Either you supplied the wrong credentials (e.g., bad password), or your browser doesn't understand how to supply the credentials required.
What I've tried so far is to edit my vhost conf like so:
Code:
<VirtualHost *:80>
ServerAdmin (email)
ServerName (domain).com
ServerAlias www.(domain).com
DocumentRoot /var/www/(dir)
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<Directory /var/www/(dir)/(subdir)>
AuthType Basic
AuthName "Authentication Required"
AuthUserFile "/path/to/authfile"
Require valid-user
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
I don't see anything wrong with this, and I'm hoping someone can tell me why I'm getting the Unauthorized error and what I should to do fix it. (I have correctly created the authfile with htpasswd, as well.)