exception for NGINX limit_req_zone
Francis Daly
francis at daoine.org
Fri Jul 20 22:38:49 UTC 2012
On Fri, Jul 20, 2012 at 09:48:04PM +0800, fhal wrote:
Hi there,
> I got a problem with NGINX limit_req_zone. Anyone can help? The problem is that, I want to limit user access to some specific URL, for example:
>
> /forum.php?mod=forumdisplay?
> /forum.php?mod=viewthread&***
>
> But, I do want to add an exception for below URL,
>
> /forum.php?mod=image&*
For nginx "location" matches, these three are all the same, and are all
exactly "/forum.php". The "location" goes from the first / to just before
the first ? or #.
That is why your configuration is not doing what you want.
> location ~*^/(home|forum|portal).php$ {
> root /web/www;
> limit_conn addr 5;
> limit_req zone=refresh burst=5 nodelay;
> fastcgi_pass unix:/tmp/nginx.socket;
> fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
> include fastcgi_params;
> }
I do not know what the solution is, but I expect it will involve doing
something different based on the value of $arg_mod, within that location
block.
How is limit_req_zone zone=refresh defined? Would using "map" to set
the relevant $variable to empty if $arg_mod is "image" be appropriate?
Good luck with it,
f
--
Francis Daly francis at daoine.org
More information about the nginx
mailing list