Saturday, November 3, 2012

How to set password for website


Inside the <Directory >….. </Directory> add the following content
AuthType Basic
AuthName "Private Documentation Repository"
AuthUserFile /var/www/html/.htpasswd
Require valid-user

Create username and password for your website
 htpasswd -c /var/www/html/.htpasswd htuser

New password:
Re-type new password:
Adding password for user htuser

Your username and password will save in this file /var/www/html/.htpasswd

Check for apache syntax error
/usr/sbin/apachectl -t
Syntax OK

Now reload/restart the apache server. Use one of the following comment to restart the apache server

service httpd restart


Now go to your website and access it.

No comments:

Post a Comment