本文介绍了阿帕奇:限制虚拟主机内访问特定的源IP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有几个同名的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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-17 04:22