问题描述
我有几个同名的Apache服务器上的虚拟主机,虚拟主机,我需要确保只有IP地址的一组特定的被允许访问之一。
I have several named virtual hosts on the same apache server, for one of the virtual host I need to ensure only a specific set of IP addresses are allowed to access.
请建议要做到这一点的最好办法。我已经看过mod_authz_hosts模块,但它并不像我能做到这一点虚拟主机内。
Please suggest the best way to do this. I have looked at mod_authz_hosts module but it does not look like I can do it inside virtual host.
推荐答案
的 mod_authz_host
指令必须是在<地点>
或<目录>
块,但我用以前在<虚拟主机>
像所以:
The mod_authz_host
directives need to be inside a <Location>
or <Directory>
block but I've used the former within <VirtualHost>
like so:
<VirtualHost *:8080>
<Location />
Order deny,allow
Deny from all
Allow from 127.0.0.1
</Location>
...
</VirtualHost>
参考:http://askubuntu.com/questions/262981/how-to-install-mod-authz-host-in-apache
这篇关于阿帕奇:限制虚拟主机内访问特定的源IP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!