Thursday, March 24, 2011

HTTP or Apache Server with Authentication

Step1: Install rpms
#rpm -ivh http*
          or
#yum install http*

Step2: Setting up the configuration file
#vim /etc/httpd/conf/httpd.conf
ESC+shift+g

<Directory "/var/www/html/test"> create index.html file in this location
AuthType Basic
AuthName "password protected"
AuthUserFile  /etc/httpd/testpass
Require user pna
<Directory>

Step3:
#htpasswd -c /etc/httpd/testpass pna
  give the password two times
#service httpd restart
#chkconfig httpd on

Step4:
#elinks http://192.168.0.254/test (it will ask for username and password for accessing the website.)

0 Comments: