Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I'm attempting to set up a server using Apache. In the conf file, I inserted the code:

<Directory />
    Options FollowSymLinks
    AllowOverride AuthConfig
    AuthType Basic
    AuthName "Restricted Files"
    AuthBasicProvider file
    AuthUserFile C:\...\serverpass.txt
    Require user Admin
</Directory>

In order to try and get Apache to require a password. I created the username and password with htpasswd -c. When I got to localhost though, it doesn't prompt me for a username and password?

share|improve this question
    
What OS are you on? –  Shane Madden Dec 6 '12 at 6:51
    
I'm on Windows 7 –  rphello101 Dec 7 '12 at 14:34
    
Thanks all. I believe the problem was the <Directory c:/path/to/webroot/>, but I also made sure to restart and use '/' instead of '\' –  rphello101 Dec 9 '12 at 22:49

4 Answers 4

up vote 2 down vote accepted

/ isn't a path in Windows, so <Directory /> won't do anything.

Consider using <Location /> or <Directory c:/path/to/webroot/>?

share|improve this answer

You did restart the apache webserver AFTER you made these changes?

Also, have you checked for conflicting directives in httpd.conf and all its include files. Remember the last overriding directive (and more specific directives) encountered wins the game and gets used.

share|improve this answer

Try using "/" as path delimiter, not the windows-typical "\".

As it says in the Apache docs:

The directives that accept filenames as arguments must use Windows filenames instead of Unix ones. However, because Apache may interpret backslashes as an "escape character" sequence, you should consistently use forward slashes in path names, not backslashes. Drive letters can be used; if omitted, the drive of the SystemRoot directive (or -d command line option) becomes the default.

share|improve this answer
<Directory />

The / here should be replaced with the specific directory where you are looking for authentication. Change it and restart the web server.

It sud work after that.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.