Apache provides access control based on client hostname, IP address, or other characteristics of the client request using mod_access module.
Open your httpd.conf file:
# vi /etc/httpd/conf/httpd.conf
Locate directory section (for example/var/www/sashika) and set it as follows:
<Directory
/var/www/sashika/>
Order allow,deny
Allow from
192.168.1.0/24
Allow from 127
</Directory>
Order allow,deny: The Order directive controls the default access state and the order in which Allow and Deny directives are evaluated. The (allow,deny) Allow directives are evaluated before the Deny directives. Access is denied by default. Any client which does not match an Allow directive or does match a Deny directive will be denied access to the server.
Allow from192.168.1.0/24: The Allow directive affects which hosts can access an area of the server (i.e. /var/www/sashika/). Access is only allowed from network 192.168.1.0/24 and localhost (127.0.0.1).
No comments:
Post a Comment