Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Can anyone help me with nginx "location" I want to add this block to my nginx conf

 location / {
       limit_conn zone_name 8; 

I need to modify location to /folder/index.php?file=x Where x can be an string (e.g 7fe8j)


share|improve this question
I'm not sure that I understand the problem. If you add that block to your nginx config, what doesn't work? – nickgrim Aug 28 '12 at 11:52
it works fine , but now i don't want location to be / .Rather i want location to be /folder/index.php?file=x Where x can be an string – Werulz Aug 28 '12 at 12:43
up vote 0 down vote accepted

I need to modify location to /folder/index.php?file=x Where x can be an string (e.g 7fe8j)

The short answer is you can't.

limit_conn directive only works in http, server, location context. And location directive only match against the URI (/folder/index.php) without query parameters (?file=x).

share|improve this answer
Ohh ......then it is possible to make it match /folder/index.php?file.The ?file is important for me as all file to be downloaded has this in their link.My objective is to control the max number of concurrent connections a downloader can make – Werulz Aug 29 '12 at 8:44
?file can be match by using if ($args ~ "^file=(.*)") { but you'll get the [emerg] "limit_conn" directive is not allowed here in message if you put a limit_conn directive inside. – quanta Aug 29 '12 at 8:58
ohh.....any other way to limit connection for /folder/index.php?file= – Werulz Aug 30 '12 at 3:37

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.