设置Apache IP白名单

时间:2013-01-07 12:48:56

标签: apache security wamp

我正在为我们的部门创建一些网络应用程序。 该部门是更大内部网的一部分,当然为更多部门提供服务。

我在一台从未使用的PC上设置了WAMP环境,并开发了一些在该部门内部使用的简单应用程序。

对于我创建别名的每个应用程序,以及一种“主页​​”,您可以在其中查看网络应用程序的“索引”。

现在我要设置apache以拒绝访问除IP列表之外的各种Web应用程序。

我尝试使用authz_host来完成此操作,但它不起作用。

遵循网络应用程序Alias的copypaste。

Alias /national-alerts/ "c:/wamp/www/national-alerts/" 

<Directory "c:/wamp/www/national-alerts/">
    Options Indexes FollowSymLinks MultiViews
    AllowOverride all
       Order deny,allow
    Deny from all
    Allow from 10.176.164.53
    Allow from 10.176.162.144
    Allow from 10.176.162.219
    Allow from 10.176.160.202
    Allow from 10.176.165.143
    Allow from 10.176.162.209
    Allow from 10.176.166.46
    Allow from 10.176.162.119
    Allow from 10.176.160.232
    Allow from 10.176.162.53
    Allow from 10.176.164.33
    Allow from 10.176.161.185
    Allow from 10.176.162.111
</Directory>

所有这些IP都来自内部网的内部IP。 因此,任何访问都会获得“拒绝访问”,例如“允许”已被完全忽略。

有人可以帮助我指出正确的示例/文档吗?

1 个答案:

答案 0 :(得分:2)

改变IP的conf对我有用。

如果Intranet的子网掩码不是255.255.0.0或更宽,那么请求的可能性不是由10.176.164.53直接发送,而是来自他的网关。

Web服务器的IP地址是什么?

当您尝试访问该页面时(例如从10.176.164.53开始),请查看apache的访问日志,并检查请求是否来自同一个ip。