Web Server configuration with Authentication to see webpage in Redhat Linux

  • Share
  • CevherShare
  • Share

Some webpage or even websites will ask for authentication to open, you may wondered about why they are using password and some ther authentication. The reason is website’s admin may want to share private message or that message have to be seen only by authenticated persons.

Read:  Web Server Configuration in Redhat

For every webpage we have  to set password individually. Here we are going to set password for website station1.example.com . Technically setting password for website means password will be set for the directory, where the website is hosted.

#vim /etc/httpd/conf/httpd.conf

<VirtualHost  192.168.1.101>

DocumentRoot /var/www/html

ServerName  station1.example.com

<Directory /var/www/rider>

AllowOverride authconfig

</Directory>

</VirtualHost>

 

Creating password for a website will only done by htaccess file.     htaccess file to be created in hidden format, so here specified as “.htaccess”

#cd /var/www/html

html] #vim .htaccess

AuthName “description”

AuthType basic

AuthUserfile /var/www/html/.pass

require valid-user

:wq!

Setting password

/var/www/html – directory, where website is hosted.

user1 – username for authentication

123 – password for authentication

#htpasswd -mc /var/www/html/.pass user1

password:123

 

prasad

About prasad

Prasad K has written 111 post in this blog.