首页 > nginx > 转老外一篇NGINX 防DDOS配置

转老外一篇NGINX 防DDOS配置

2011年1月19日 eric 发表评论 阅读评论

FreeBSD, network card: Intel fxp, port: 100Мбит, polling, http accept-filter.
in sysctl:

sysctl kern.maxfiles=90000
           sysctl kern.maxfilesperproc=80000
           sysctl net.inet.tcp.blackhole=2
           sysctl net.inet.udp.blackhole=1
           sysctl kern.polling.burst_max=1000
           sysctl kern.polling.each_burst=50
           sysctl kern.ipc.somaxconn=32768
           sysctl net.inet.tcp.msl=3000
           sysctl net.inet.tcp.maxtcptw=40960
           sysctl net.inet.tcp.nolocaltimewait=1
           sysctl net.inet.ip.portrange.first=1024
           sysctl net.inet.ip.portrange.last=65535
           sysctl net.inet.ip.portrange.randomized=0

in nginx configuration:

  worker_processes 1;
           worker_rlimit_nofile 80000;
           events {
               worker_connections 50000;
           }

           server_tokens off;
           log_format IP `$remote_addr';
           reset_timedout_connection on;

           listen  xx.xx.xx.xx:80  default rcvbuf=8192 sndbuf=16384 backlog=32000 accept_filter=httpready;
 

In the following way it is possible to realize filtration of url, in example for POST
index.php?action=login which is with empty referral.

   set $add 1;
           location /index.php {
                   limit_except GET POST {
                        deny all;
               }
               set $ban "";
               if ($http_referer = "" ) {set $ban $ban$add;}
               if ($request_method = POST ) {set $ban $ban$add;}
               if ($query_string = "action=login" ){set $ban $ban$add;}
               if ($ban = 111 ) {
                   access_log /var/log/[133]nginx/ban IP;
                   return 404;
               }
               proxy_pass http://127.0.0.1:8000; #here is a patch
           }
 

Further we cut it at pf level – loaded into IP table, hosts from which came too many hits.
PF with tables works very quickly. Sources for parsing of logs (ddetect) you can find on http://www.comsys.com.ua/files
Then Cron used once in a minute, to add into ip tables new IPs from a log.
25 Mbyte DDoS, which cuts IPs, the rests fall on nginx which by it is criterion pass IPs and the rests passed on the apache – LA 0, site works.

转载请注明:文章转载自:Eric's linux and nginx! (http://www.nginxs.com)
本文地址:http://www.nginxs.com/linux/433.html

分类: nginx 标签: , ,
  1. 2017年12月16日20:28 | #1

    payday advance best cash loan direct payday loan lenders [url=https://cashadvance.us.org]cash advance[/url]

  2. 2017年12月16日23:19 | #2

    payday loans online
    payday loans no credit check
    payday loans online
    payday loans no credit check
    payday loans online

  3. 2017年12月20日11:05 | #3

    online casino games
    online casino real money
    online casino
    online casino games
    casino games

  4. 2017年12月23日09:58 | #4

    payday loans online no credit check
    payday loans online no credit check
    payday loans no credit
    payday loans online no credit check
    payday loans no credit

  5. 2017年12月24日07:55 | #5

    payday loans online direct lenders
    payday loans direct lenders
    online loans for bad credit
    loans online no credit check

  6. 2017年12月29日14:52 | #6

    real money casino
    casino online
    casino online
    casino games
    casino games

  7. 2017年12月29日17:55 | #7

    Spot on with this write-up, I actually think this amazing site needs much
    more attention. I’ll probably be back again to read
    through more, thanks for the information!

  8. 2017年12月31日15:08 | #8

    For the reason that the admin of this web page is working, no hesitation very shortly it will be well-known, due to its quality contents.
    cialis online

  9. 2018年1月2日06:12 | #9

    no download casino slots games
    casino
    best place to play online roulette

  10. 2018年1月3日20:17 | #10

    payday loans no credit
    payday loans online no credit check
    payday loans no credit check
    loans online
    payday loans online

  11. 2018年1月4日12:45 | #11

    Diario é seguro http://farmacia-en-linea.life/parilac.html comprar España sin receta.

  12. 2018年1月5日00:42 | #12

    online casino slots
    online casino no deposit bonus
    casino games slots free
    casino online subtitrat

  13. 2018年1月6日01:16 | #13

    Donde comprar en farmacias http://farmacia-en-linea.life/biotrim.html donde puedo conseguir en Peru.

  14. 2018年1月6日15:03 | #14

    Farmacia sana sana http://farmaciaenlinea.life/medifen.html comprar sin receta en farmacia España.

  15. 2018年1月6日15:33 | #15

    Thanks for a marvelous posting! I truly enjoyed reading it, you might be a great author.I
    will be sure to bookmark your blog and will come back in the foreseeable
    future. I want to encourage that you continue your great posts, have a nice holiday weekend!

  16. 2018年1月6日21:39 | #16

    I’m curious to find out what blog platform you’re working with?

    I’m having some minor security issues with my latest blog and I would like to find something
    more safeguarded. Do you have any recommendations?

  17. 2018年1月7日11:08 | #17

    online casino real money
    slots casino games
    free casino slots
    online casino games
    casino free games

  18. 2018年1月8日02:25 | #18
  19. 2018年1月8日05:37 | #19

    Canada prescription required http://www.animesama.ru/user/VSFShellie/ cheap australia.

  20. 2018年1月8日06:24 | #20

    research paper who to write a research paper research paper [url=https://researchpaper.us.com]college level essay writing[/url]

  21. 2018年1月8日11:27 | #21

    price comparison usa http://www.cervacentro.com.br/component/k2/itemlist/user/23449 where can i buy in the us.

  22. 2018年1月8日14:15 | #22

    retail price usa http://www.paranormalworld.com/component/k2/itemlist/user/1973693 over the counter substitute for.

  23. 2018年1月8日17:23 | #23

    purchase online with prescription http://www.ursthailand.com/index.php/component/k2/itemlist/user/2008125 non prescription costs.

  24. 2018年1月8日20:09 | #24

    Buy generic online fast shipping http://www.praca-budowa.pl/author/joshuaj375/ generic price.

  25. 2018年1月8日23:04 | #25

    medicine cost http://reading-games.net/profile/feliciag441 can you buy over the counter.

  26. 2018年1月9日00:44 | #26

    cheapest uk http://www.gamestockade.com/profile/97207/befkatherin best price on generic.

  27. 2018年1月9日01:40 | #27

    purchasing online safe http://wiki.samistine.com/User:AshtonMcGuigan1 tablet price philippines.

  28. 2018年1月9日08:40 | #28

    price of generic in canada http://www.drjitendra.com/does-best-tablets-uk-sometimes-make-you-feel-stupid/ where to buy in australia.

  29. 2018年1月9日13:56 | #29

    purchasing online for cheap http://healthywoman.co/node/1088872 generic pill.

  30. 2018年1月9日19:43 | #30

    Bestellen bij apotheek frankrijk, http://online-medicijnen-bestellen.life/fucidin.html , veilig kosten.

  31. 2018年1月9日22:15 | #31

    Kopen bij drogist nederland, http://onlinemedicijnenbestellen.life/unisom.html , prijs apotheek frankrijk.

  32. 2018年1月9日23:59 | #32

    Achat belgique http://medicamentsonline.life/femsept.html vente Belgique.

  33. 2018年1月10日02:34 | #33

    Bestellen online prijzen, http://onlinemedicijnenbestellen.life/imitrex.html , nederland kopen goedkoop.

  34. 2018年1月10日02:55 | #34

    Goedkoop betrouwbaar prijs, http://online-medicijnen-bestellen.life/ampicillin.html , veilig kopen online.

  35. 2018年1月11日20:11 | #35

    pris apotek pris, http://forste-apotek-norge.life/silagra.html , kjøpe i Danmark.

  36. 2018年1月11日21:44 | #36

    Norge Oslo, http://forste-apotek-norge.life/cabgolin.html , kjøp generisk til salg.

  37. 2018年1月12日02:51 | #37

    beställa kostnad, http://apotekvarerpanettet.life/metformin.html , sälja kostnad.

  38. 2018年1月12日05:01 | #38

    bestill nett, http://apoteknettbutikknorge.life/finpecia.html , uten resept Sverige.

  39. 2018年1月12日12:16 | #39

    autocad lt student
    autocad 2017
    cheapest autocad 2014

  40. 2018年1月13日05:50 | #40

    Greetings from Ohio! I’m bored at work so I decided to check out your site on my iphone during lunch break.
    I love the knowledge you present here and can’t
    wait to take a look when I get home. I’m surprised at how fast your blog loaded on my phone ..
    I’m not even using WIFI, just 3G .. Anyhow, wonderful blog!

  41. 2018年1月15日06:36 | #41

    loans for bad credit
    payday loans online no credit check
    payday loans online no credit check
    payday loans no credit check
    loans no credit

  42. 2018年1月17日23:13 | #42

    online casino slots
    free casino games and poker
    casino online gambling
    casino online application

  43. 2018年1月18日14:08 | #43

    casinos online
    casino games slots
    new usa online casinos 2017
    online casino

  44. 2018年1月19日09:41 | #44

    online casino bovada
    online casinos for us players
    top online casino
    slots for money online
    free casino games no download no registration

  45. 2018年1月19日16:39 | #45

    vegas casino games
    online casino real money
    casino g
    casino games free

  46. 2018年1月20日12:54 | #46

    casino games list
    casino games real money
    online casino slots
    casino games free online

  47. 2018年1月21日22:49 | #47

    Great post. I used to be checking constantly this blog and I’m inspired!
    Very useful information specifically the final part :) I take care of such info a lot.
    I was seeking this particular info for a long time. Thanks and
    good luck.

  48. 2018年1月22日01:36 | #48

    you’re in point of fact a just right webmaster. The web
    site loading velocity is amazing. It seems that you are doing any unique trick.
    Furthermore, The contents are masterpiece. you’ve done a
    excellent process on this topic!

  49. 2018年1月22日05:19 | #49

    loans online instant approval
    payday loans las vegas
    payday loans online bad credit
    loans online no credit check

评论分页
1 ... 6 7 8 433
订阅评论
1+4= (必填)