Quantcast
Channel: iRedMail
Viewing all articles
Browse latest Browse all 14127

Need to password protect Apache subdir

$
0
0

==== Required information ====
- iRedMail version: 0.8.7
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): MySQL
- Linux/BSD distribution name and version: Ubuntu Server 14.04
- Related log if you're reporting an issue:
====

How can I password protect a subdir of an existing Apache dir? I'm asking here because I set up iRedMail on a fresh server install, so the rest of my web sites use that setup. My sites run just fine, but I really want to HTTP password protect subdirs of those sites. I've been all over the place looking for an answer with no luck. I've already tried a few configs, any of which should have worked but don't.

This is one config I tried:

<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>

This results in seeing this in my browser:

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.

The Apache error.log says

[Sun Jul 13 21:13:16.809158 2014] [:error] [pid 17914] No requires line available

I would appreciate any advice on why this is happening and how to fix it.

I also wouldn't mind making this work using mysql/dbd auth, if anyone can tell me what a working vhost config should look like.


Viewing all articles
Browse latest Browse all 14127

Trending Articles