Apache (Web Server) - Require ip directive (whitelist)

by
Jeremy Canfield |
Updated: September 28 2021
| Apache (Web Server) articles
The Require ip directive in the web servers configuration file (e.g. httpd.conf) can be used so that only certain IP addresses (or subnets) are allowed to access a particular resource. In this example, only IP address 10.14.115.25 would be permitted access .
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny, allow
Deny from all
Require all granted
Require ip 10.14.115.25
</Directory>
In this example, any IP address within the 192.168.0.0/24 subnet would be permitted access.
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny, allow
Deny from all
Require all granted
Require ip 192.168.0.0/24
</Directory>
Did you find this article helpful?
If so, consider buying me a coffee over at