Apache Authentication How to Configure Apache Authentication Module In Rhel5

system1: httpd server authentication
Step 1:Configure dns Step 2:Install http packages
#yum install httpd Step 3:Create html file
#vim /var/www/html/main.html
<html>
<head><title>Sample Web Page</title></head>
<body>
<font size=”40” color=”FF0000”>
<marquee>This is Home Page of Leena.com</marquee>
</font></body></html>
Step 4: Apache Authentication Apache configuration
Add html page to http configuration file
#vim /etc/httpd/conf/httpd.conf
Line no: 326
AllowOverride AuthConfig
Line no: 390
Directory Index main.html index.html index.html.var
Step 5:
create .htaccess file in document root of web page
#vim /var/www/html/.htaccess
AuthName “Restricted Web Site”
AuthType Basic
AuthUserFile /etc/httpd/conf/.htpasswd­system1
require valid­user
Step 6:change group and permissions of the file
#chgrp apache /var/www/html/.htaccess
#chmod 640 /var/www/html/.htaccess
Step 7:create .htpasswd file
#htpasswd ­mc /etc/httpd/conf/.htpasswd­system1 user1
#htpasswd ­m /etc/httpd/conf/.htpasswd­system1 user2
Step 8:
restart the http service
#chkconfig httpd on
#service httpd restart
sys1:
Step 9:
add dns entries in /etc/resolv.conff
#vim /etc/resolv.conf
Step 10:
open firefox and type the following url in address bar
http://system1.leena.com
Finally web server Apache server authentication configure successfully.

Related post