Require ip x.x.x.x not working in Apache 2.4
Solution 1:
Example of access restriction from IP addresses for Apache 2.4:
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
<IfModule mod_authz_core.c>
<RequireAny>
Require ip 127.0.0.1
Require ip ::1
Require ip x.x.x.x
</RequireAny>
</IfModule>
</Directory>
Don't forget to restart apache service by running this command:
service httpd restart
Also don't use directory /
for security reasons.