[心得]怎麼讓apache阻擋某些IP的訪客?
2005/10/09 13:59
瀏覽2,856
迴響1
推薦3
引用0
本站之前疑似遇到駭客攻擊...
看到一些方法來預防...
其中我覺得很有效的就是直接在apache中設定組態,阻擋某些IP進入自己的網站
設定方法如下:
1.打開apache的httpd.conf
2.找到以下的敘述,並加入紅色的程式碼:
#
# Aliases: Add here as many aliases as you need (with no limit). The format is
# Alias fakename realname
#
#
# Note that if you include a trailing / on fakename then the server will
# require it to be present in the URL. So "/icons" isn't aliased in this
# example, only "/icons/". If the fakename is slash-terminated, then the
# realname must also be slash terminated, and if the fakename omits the
# trailing slash, the realname must also omit it.
#
Alias /icons/ "C:/AppServ/Apache/icons/"
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
#
# ScriptAlias: This controls which directories contain server scripts.
# ScriptAliases are essentially the same as Aliases, except that
# documents in the realname directory are treated as applications and
# run by the server when requested rather than as documents sent to the client.
# The same rules about trailing "/" apply to ScriptAlias directives as to
# Alias.
#
ScriptAlias /cgi-bin/ "C:/AppServ/www/cgi-bin/"
#
# "C:/Apache/cgi-bin" should be changed to whatever your ScriptAliased
# CGI directory exists, if you have that configured.
#
AllowOverride None
Options None
Order allow,deny
Allow from all
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
Deny from 140.113.150.66
Deny from 140.113.150
# End of aliases.
3.解說:
Deny from 140.113.150.66 代表阻擋來自140.113.150.66這個IP的訪客
Deny from 140.113.150 代表阻擋來自140.113.150.1~140.113.150.254這些IP的訪客
4.要阻擋的IP可以任意的增加...
看到一些方法來預防...
其中我覺得很有效的就是直接在apache中設定組態,阻擋某些IP進入自己的網站
設定方法如下:
1.打開apache的httpd.conf
2.找到以下的敘述,並加入紅色的程式碼:
#
# Aliases: Add here as many aliases as you need (with no limit). The format is
# Alias fakename realname
#
#
# Note that if you include a trailing / on fakename then the server will
# require it to be present in the URL. So "/icons" isn't aliased in this
# example, only "/icons/". If the fakename is slash-terminated, then the
# realname must also be slash terminated, and if the fakename omits the
# trailing slash, the realname must also omit it.
#
Alias /icons/ "C:/AppServ/Apache/icons/"
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
#
# ScriptAlias: This controls which directories contain server scripts.
# ScriptAliases are essentially the same as Aliases, except that
# documents in the realname directory are treated as applications and
# run by the server when requested rather than as documents sent to the client.
# The same rules about trailing "/" apply to ScriptAlias directives as to
# Alias.
#
ScriptAlias /cgi-bin/ "C:/AppServ/www/cgi-bin/"
#
# "C:/Apache/cgi-bin" should be changed to whatever your ScriptAliased
# CGI directory exists, if you have that configured.
#
AllowOverride None
Options None
Order allow,deny
Allow from all
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
Deny from 140.113.150.66
Deny from 140.113.150
# End of aliases.
3.解說:
Deny from 140.113.150.66 代表阻擋來自140.113.150.66這個IP的訪客
Deny from 140.113.150 代表阻擋來自140.113.150.1~140.113.150.254這些IP的訪客
4.要阻擋的IP可以任意的增加...
你可能會有興趣的文章:
限會員,要發表迴響,請先登入




