It is a pain in the ass to set a bunch of IP adresses in each vhost or where ever you need it. But with Apache 2.4 it is quiet easy to have a global list and use that anywhere in your config.


Define BADIPS "188.40 46.4 176.9 46.166 46.21 78.46"
<VirtualHost *:80>
    DocumentRoot /var/www/
    FileETag MTime Size
    <Directory /var/www/>
        Options Indexes FollowSymLinks Multiviews ExecCGI
        AllowOverride None
    Require all granted
    Require not ip ${BADIPS}
        AddHandler fcgid-script .php
        FCGIWrapper /usr/bin/php5-cgi .php
    ErrorLog /var/log/apache2/mario_error.log
    LogLevel warn

    CustomLog /var/log/apache2/mario_access.log combined