Apache Network Based Authentication

Step 1. Open the httpd.conf file and go to the bottom of the file & put the below mentioned entries

[root@localhost ~]# vim /etc/httpd/conf/httpd.conf 

 
ServerAdmin root@localhost.localdomain 
DocumentRoot /var/www/html
< Directory /var/www/html >
Order Allow, Deny
Allow from 10.0.0.0/8
Deny from All

ServerName www.linuxonlinesolutions.com 
ErrorLog /etc/httpd/logs/error_log 
CustomLog /etc/httpd/logs/access_log common 
 

Here above, i defined the order to access the website. There are only two options that can be used, allow and deny. Put the ip range which you want to allow and deny all other networks.

Step 2. Start the httpd service

[root@localhost ~]# service httpd restart
You can leave a response, or trackback from your own site.

Leave a Reply