Specifying Listen
actually tells Apache on which ports and ip-addresses it should be hosting the server and not which ip-addresses can access the server. What you are looking for is an Apache Access Control and here you will see that you need to enable the mod_authz_host
and then you can Allow
or Deny
hosts and ip-addresses.
In your httpd.conf look for the following line:
LoadModule authz_host_module modules/mod_authz_host.so
Make sure there is no '#' in front of the LoadModule
Now go down to your configured VirtualHost
and add the following lines:
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
#below add your acceptable IPs
Allow from 127.0.0.0/12.12.12.12
</Directory>
Note that using a hostname will incur a reverse DNS lookup so can be slow.