Nginx+iptablesÆÁ±Î·ÃÎÊWebÒ³Ãæ¹ýÓÚƵ·±µÄIP(·ÀDDOS£¬¶ñÒâ·ÃÎÊ£¬²É¼¯Æ÷)
ͨ¹ý·ÖÎönginxµÄÈÕÖ¾À´¹ýÂ˳ö·ÃÎʹýÓÚƵ·±µÄIPµØÖ·£¬È»ºóÌí¼Óµ½nginxµÄblockip.conf£¬²¢ÖØÆônginx
½Å±¾ÈçÏÂ:
#!/bin/sh nginx_home = /Data/app_1/nginx log_path = /Data/logs /usr/bin/tail -n50000 $log_path/access.log \ |awk ¡®$8 ~/aspx/{print $2,$13}¡¯ \ |grep -i -v -E ¡°google|yahoo|baidu|msnbot|FeedSky|sogou¡± \ |awk ¡®{print $1}¡¯|sort|uniq -c |sort -rn \ |awk ¡®{if($1>150)print ¡°deny ¡°$2¡å;¡±}¡¯> $nginx_home/conf/vhosts/blockip.conf /bin/kill -HUP `cat $nginx_home/nginx.pid`
Ò²¿ÉÒÔͨ¹ý·ÖÎönginxÈÕÖ¾¹ýÂ˳öƵ·±·ÃÎÊIP£¬Ö±½ÓÓÃiptablesÆÁ±ÎÕâ¸öIP£¬¾ÍÓò»×ÅÖØÆônginxÁË£¬²¢ÇÒÆÁ±ÎЧ¹û¸üºÃ¡£
µ¥¸öIPµÄÃüÁîÊÇ
iptables -I INPUT -s 124.115.0.199 -j DROP
·âIP¶ÎµÄÃüÁîÊÇ
iptables -I INPUT -s 124.115.0.0/16 -j DROP
·âÕû¸ö¶ÎµÄÃüÁîÊÇ
iptables -I INPUT -s 194.42.0.0/8 -j DROP
·â¼¸¸ö¶ÎµÄÃüÁîÊÇ
iptables -I INPUT -s 61.37.80.0/24 -j DROP iptables -I INPUT -s 61.37.81.0/24 -j DROP
¸Õ²Å²»Ð¡ÐĸãµÄ×Ô¼º¶¼Á¬²»ÉÏÁË-_-!!!
iptables -I INPUT -p tcp ¨Cdport 80 -s 124.115.0.0/24 -j DROP
ÒÔºóÓÃÕâÖÖÖ»·â80¶Ë¿Ú¾ÍÐÐÁË£¬²»»á³öÎÊÌâ!
iptables -I INPUT -p tcp ¨Cdport 80 -s 124.115.0.0/24 -j DROP iptables -I INPUT -s 61.37.81.0/24 -j DROP½â·â
iptables -F
Çå¿Õ
iptables -D INPUT Êý×
ÍƼöÐÅÏ¢
- linuxÃüÁîѧϰ±Ê¼Ç£¨11£©£ºnlÃüÁî
- linuxÃüÁîѧϰ±Ê¼Ç£¨5£©£ºrmÃüÁî
- linuxÃüÁîѧϰ±Ê¼Ç£¨4£©£ºmkdirÃüÁî
- linuxÃüÁîѧϰ±Ê¼Ç£¨1£©£ºlsÃüÁî
- ½«CentosµÄyumÔ´¸ü»»Îª¹úÄڵİ¢ÀïÔÆÔ´
- ʹÓÃNginxÌí¼Óheader·ÀÖ¹ÍøÒ³±»frame
- linuxϼÓËÙscp´«Êä´óÎļþµÄËÙ¶È
- linuxϵͳÉ϶ÔnginxÈÕÖ¾·Ö¸î´¦Àí
- lnmp/nginxϵͳÕæÕýÓÐЧµÄͼƬ·ÀµÁÁ´ÍêÕûÉèÖÃÏê½â
- Í»ÆÆÊ®Íò²¢·¢µÄNginxµÄÅäÖü°ÓÅ»¯
ÈÈÃÅÐÅÏ¢
- nohup: redirecting stderr to stdou....
- ʹÓÃlog_formatΪNginx·þÎñÆ÷ÉèÖøüÏêϸµÄÈÕÖ¾¸ñʽ
- jquery easyUI--dataGrid-Json
- [Ô´´]·ÂGoogle Reader¡¢ÐÂÀË΢²©¡¢ÌÚѶ΢²©µ....
- ÀûÓÃKeepalived+mysql¹¹½¨¸ß¿ÉÓÃMySQLË«Ö÷×Ô¶....
- Nginx+keepalivedʵÏÖ¸ºÔؾùºâºÍË«»úÈȱ¸¸ß¿ÉÓÃ
- jqueryʵÏÖÒ³Ãæ¼ÓÔؽø¶ÈÌõ
- Rolling cURL: PHP²¢·¢×î¼Ñʵ¼ù
- codeigniter ·ÓÉÖÕ¼«ÓÅ»¯(url rewrite)
- linuxÏÂÉèÖÃsshÎÞÃÜÂëµÇ¼
×î½ü¸üÐÂ
- ²éÕÒ²¢É¾³ý.svnĿ¼Îļþ
- redis ÆßÖÖÊý¾ÝÀàÐ͵ÄʹÓó¡¾°
- linux ÏÂÎļþ¸´ÖƵ½windowsÏÂÂÒÂëµÄ½â¾ö°ì·¨
- nginx³öÏÖ502 upstream sent too big he....
- linuxÏÂsudoÅäÖÃÏê½â
- linuxÃüÁîѧϰ±Ê¼Ç£¨15£©£ºtailÃüÁî
- linuxÃüÁîѧϰ±Ê¼Ç£¨14£©£ºheadÃüÁî
- linuxÃüÁîѧϰ±Ê¼Ç£¨13£©£ºlessÃüÁî
- linuxÃüÁîѧϰ±Ê¼Ç£¨12£©£ºmoreÃüÁî
- ¼ÓÃÜËã·¨±È½Ï3DES AES RSA ECC MD5 SHA1µÈ
ÆÀÂÛ