Skip to main content

Thread: Apache2 password protect "/var/www" root folder


hello,

we're running ubuntu server 12.04 , apache2 serve out webpage , it's running fine. however, owner of site password protect entire website including homepage located in /var/www folder. i've been able password protect "subfolder" below root no problem, e.g., /var/www/testfolder or /var/www/forms i'm unable root folder (/var/www) password protected using similar setup.

i'd read it's best avoid using .htaccess file method , instead modify httpd.conf file in /etc/apache2 folder specify folder(s) should password protected. so, created password file named "passwords" using htpasswd utility , stored password file in new folder created isn't located on website (/usr/local/apache). edited httpd.conf file in /etc/apache2 folder , contains following lines -

<directory "/var/www/testfolder">
authtype basic
authname "restricted"
authbasicprovider file
authuserfile /usr/local/apache/passwords
require user testuser
allow 192.168.1.99 [the computer @ ip doesn't need authenticate]
order allow,deny
satisfy any
</directory>

httpd.conf file above lines sucessfully password protects "testfolder" folder. if change top line of httpd.conf config point "root" /var/www never receive password prompt.

i've tried lot of variations on <directory "/var/www"> line try work , after made each of test modification stopped , restarted apache2 server. i've tried - <directory "/var">, <directory "/var">, <directory "/">, <directory "/var/*">, <directory "/var/www/*">, etc. i've tried quite few more variations listed above none of them seems work. once again, if change <directory line /var/www/testfolder or other subfolder password prompt every time on subfolders.

tried giving on "var/www" folder , instead edited "default" file in "sites-available" folder , changed document root /var/www /var/www/testfolder once did "testfolder" lost it's password protection while once again subfolder below "new root" password protected.

haven't made modifications apache2.conf file located in /etc/apache2 folder. website root folder have own special set of permissions or somehow able deny password protection or authentication overrides?

thanks, appreciated...



Forum The Ubuntu Forum Community Ubuntu Specialised Support Ubuntu Servers, Cloud and Juju Server Platforms [ubuntu] Apache2 password protect "/var/www" root folder


Ubuntu

Comments

Popular posts from this blog

Some mp4 files not displaying correctly (CS6)

Thread: Samba is not authenticating with LDAP