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

I have a Debian Stable with its regular Apache2 server running. It works fine otherwise, it just does nothing with a .htaccess that I put into a directory (/var/www/admin/. It says:

AuthType Basic
AuthName admin
AuthUserFile /var/www/admin/.htpasswd
Require valid-user

And in the same folder there is the .htpasswd in the same folder.

I checked the /var/log/apache/error.log, but it does not show anything.

I added a

<Directory /var/www/>
    AllowOverride All
</Directory>

to the apache.conf, but that did not change anything either.

How can I get this to work?

share|improve this question

1 Answer 1

up vote 3 down vote accepted

Did you remember to restart apache after adding the

<Directory /var/www/>
    AllowOverride All
</Directory>

to your configuration ? The only way I can reproduce what you see is to do this. As soon as I restart apache it all starts working as expected.

EDIT: based on the comments it looks like the directives above have been added to the wrong file. They have been added to /etc/apache2/apache.conf rather than the /etc/apache2/sites-enabled/000-default file.

share|improve this answer
    
I did a /etc/init.d/apache2 restart and it did not complain about a malformed config. Is there a difference between apache.conf and httpd.conf maybe? –  queueoverflow Dec 9 '11 at 11:04
1  
You want to put the directive in the vhost configuration file that relates to this particular host. If you have only one site then this is probably /etc/apache2/sites-enabled/000-default (or similar). –  Iain Dec 9 '11 at 11:30
    
I do not have any vhosts (never used it). I just have the vanilla 127.0.0.1 running. Do I need to create a vhost? –  queueoverflow Dec 9 '11 at 12:10
    
You will probably find that you are using the default vhost which is located in /etc/apache2/sites-enabled/000-default –  Iain Dec 9 '11 at 12:14
    
Ah, there is such a file and it has AllowOverride None. That makes all sense now. Wow, Debian is a server fortress. –  queueoverflow Dec 9 '11 at 13:17

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.