|
This 'how-to' is to explain how to use apache 2.2 with the add on
mod_authz_owner to protect a directory with htpasswd so that only the
owner of the directory can access it. Name: Apache HomePage: http://www.apache.org/ Function: Webserver
1. Firstly lets make a file mkdir /var/ww/html/private 2. Now lets change it's owner and permissions chown user1:user1 -R /var/www/html/private chmod ug+rwx -R /var/www/html/private  3. Make the index.html file nano /var/www/html/private/index.html
Code.conf:
<html> <head> <title> Test Index Page <title> </head> <body> OpenSourceHowTo.Org rocks!!! And the How-To on apache 2.2, htpasswd & mod_authz_owner worked!! </body> </html> |
 4. Now set a username/password the same the owner of the file htpasswd -c /etc/httpd/conf/htpasswd user1
 5. Next add the following the httpd.conf file nano /etc/httpd/conf/httpd.conf file
httpd.conf:
<Directory /var/www/html/pma> AuthName "only pma has access" AuthType basic AuthUserFile /etc/httpd/conf/htpasswd require file-owner </Directory>
|
 6. Next restart apache /etc/init.d/httpd restart
 7. Go the the web address and enter in your password and username http://ip-address-of-the-apache-box/private
BookMarking:
cell1
|
|
cell3 |
|
cell4
|
|
Trouble Shooting:
Go to the wiki page Go to the 'Contact Us ' Forum Go to the how-to's Support Forum
External Links:
http://httpd.apache.org/docs/2.2/howto/auth.html |