Apache从外部文件中的ip列表中拒绝 [英] Apache deny from list of ip's in external file

查看:93
本文介绍了Apache从外部文件中的ip列表中拒绝的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想维护一个文件,其中包含被禁止使用站点的ip列表. 我了解可以使用deny from来实现此目的(例如,从127.0.0.1 10.0.0.1 some.other.ip.address拒绝).

I'd like to maintain a file which includes a list of ip's which are blocked from using a site. I understand deny from can be used to achieve this (e.g Deny from 127.0.0.1 10.0.0.1 some.other.ip.address).

但是,我想要一个外部文件,以便没有访问配置权限的个人可以使用ip更新txt文件,然后该文件将被包含在拒绝中.

However, I'd like an external file so that an individual who does not have access to the config can update a txt file with ip's and this will then be included in the deny from.

有人对如何实现这一目标有任何建议吗?任何帮助都非常有用.

Does anyone have any reccomendations on how this can be achieved? Any help is greatly appriciated.

推荐答案

查看Apache Include指令:

Look at the Apache Include directive:

http://httpd.apache.org/docs/2.2/mod/core.html#include

您可以创建一个单独的配置文件,其中包含您的拒绝列表,并包括在任何其他配置文件中,即,站点可用的站点.以下是示例用法:

You can create a seperate configuration file contain you denied list and include in any other configuration file i.e a site in sites-available. Example usage below:

在/etc/apache2/sites-enabled/yoursite.conf

In /etc/apache2/sites-enabled/yoursite.conf

<VirtualHost *:80>
...

Include /etc/apache2/sites-access/yoursite.conf

...
</VirtualHost>

在/etc/apache2/sites-access/yoursite.conf

In /etc/apache2/sites-access/yoursite.conf

order allow,deny
deny from 10.0.0.1
allow from all

这篇关于Apache从外部文件中的ip列表中拒绝的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆