Tuesday, March 25, 2008

How to protect web document and directory by using password in apache web server

How to protect web document and directory by using password in apache web server
  




Apache: Creating and Using an ".htaccess" File


Below is a sample ".htaccess" file which goes in
"/usr/local/apache/htdocs/chirico/alpha/.htaccess" for this
example


AuthUserFile /usr/local/apache/htdocs/chirico/alpha/.htpasswd
AuthGroupFile /dev/null
AuthName "Your Name and regular password required"
AuthType Basic


require valid-user


In order for this to work /usr/local/apache/conf/httpd.conf must
have the following line in it:


#

AllowOverride FileInfo AuthConfig Limit
Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec

Order allow,deny
Allow from all


Order deny,allow
Deny from all





Also, a password file must be created

$ /usr/local/apache/bin/htpasswd -c .htpasswd chirico

And enter the user names and passwords.

Next Reload Apache:

$ /etc/init.d/httpd reload

3 comments:

blogs said...

I really appreciate the kind of topics you post here. Thanks for sharing us a great information that is actually helpful. Good day! Folder Lock With regard to PC 1. 2 - Don't Waste Time Searching, Read through Exactly About Cellular Desktops In this article protect folder windows 7

merabulla said...

Thanks for the information. Does it work with windows server?

Kevin Dellinger said...

What's up, I desire to subscribe for this webpage to get latest updates, so where can i do it please assist. Visit site: Top Nine Funny Encryption Software Quotes & Nine Reasons Why You Can’t How To Encrypt A Password For Free Without Social Media.