I'd like to maintain a file which includes a list of ip's which are blocked from using a site. I understand deny from can be used to achieve this (e.g Deny from 127.0.0.1 10.0.0.1 some.other.ip.address).
However, I'd like an external file so that an individual who does not have access to the config can update a txt file with ip's and this will then be included in the deny from.
Does anyone have any reccomendations on how this can be achieved? Any help is greatly appriciated.
In this tutorial, you've learned the easy way to block or allow visitors from specific countries. All you need to do is generate the country's IP address via Country IP Blocks, then insert an access control list (ACL) into your . htaccess file.
Apache makes it easy to whitelist IP access to certain locations of your website and deny traffic to all other IP addresses. You can add the following to your /etc/apache2/apache2. conf file.
If you wish to restrict access to portions of your site based on the host address of your visitors, this is most easily done using mod_authz_host .
Look at the Apache Include directive:
http://httpd.apache.org/docs/2.2/mod/core.html#include
You can create a seperate configuration file contain you denied list and include in any other configuration file i.e a site in sites-available. Example usage below:
In /etc/apache2/sites-enabled/yoursite.conf
<VirtualHost *:80>
...
Include /etc/apache2/sites-access/yoursite.conf
...
</VirtualHost>
In /etc/apache2/sites-access/yoursite.conf
order allow,deny
deny from 10.0.0.1
allow from all
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With