3

My website is a forum, and it has 3 type of URLs as below:

  1. Thread view:

    forum.php?mod=viewthread&tid=1256&page=2

  2. Thread List:

    forum.php?mod=forumdisplay&fid=125&page=61

  3. Display pictures:

    forum.php?mod=attachment&aid=afklafaklj

Because now my website has lots data and have more than 10,000,000 threads, some guys are trying to slow down my website by access hundreds the thread list pages. For example, they use curl to get below links at the same time:

forum.php?mod=forumdisplay&fid=1&orderby=replies&filter=reply&orderby=replies&page=600
forum.php?mod=forumdisplay&fid=1&orderby=replies&filter=reply&orderby=replies&page=7000
forum.php?mod=forumdisplay&fid=1&orderby=replies&filter=reply&orderby=replies&page=869
forum.php?mod=forumdisplay&fid=1&orderby=replies&filter=reply&orderby=replies&page=10000

These kind of access will bring extra pressure to MySQL and slow down the website.

So I want to add a connection limit for these URL. 1. For Display pictures and view thread (type 1 and 3), no connection limit; 2. For thread list (type 2), limit to 5 per IP.

I know that I can use limit_conn_zone and limit_req_zone to do that. But the thing is that all my URLs are staring with forum.php. So I need to limit connections based on different parameters.

Can anyone help? Thanks.

Will
  • 1,127
  • 10
  • 25
Free P
  • 31
  • 1

0 Answers0