I have a problem with Apache, I need protect the site folder with a password, I have made too many times but in this server don't work and do not know how to do. I insert this to .htaccess file:

AuthType Basic
AuthName "Members Only"
AuthUserFile /opt/.htpasswd
require valid-user

I have create the file /opt/.htpasswd with htpasswd command but when I go to the site don't show any popup that ask the password

  • Can the Apache process read /opt/.htpasswd? Can it read the associated .htaccess file? Does the Apache configuration allow configuration override? – John WH Smith Dec 9 '14 at 9:01
  • AllowOverride is set to All and i change owner to apache but nothing changed – hellb0y77 Dec 9 '14 at 9:44

You probably don't have the auth_basic module installed or enabled in this Apache. You can check by doing ls /etc/apache2/mods-enabled to see if auth_basic.load is there and enable it by doing:

a2enmod auth_basic

As basic authentication (over non-encrypted HTTP) can pose a security problem, because the username and password can be sniffed, it is not always enabled by default.

  • i have apache 2.2.15 and module auth s enabled: "LoadModule auth_basic_module modules/mod_auth_basic.so" – hellb0y77 Dec 9 '14 at 9:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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