# "limit\_req\_zone" unknown directive

**URL:** <https://www.ruby-forum.com/t/limit-req-zone-unknown-directive/198295>\
**Category:** NGINX\
**Created:** [October 29, 2010, 12:34pm UTC](https://www.ruby-forum.com/t/limit-req-zone-unknown-directive/198295 "2010-10-29T12:34:25Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![okkezSS](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/85f322/32.png) [@okkezSS](https://www.ruby-forum.com/u/okkezSS)\
**Post date:** [October 29, 2010, 12:34pm UTC](https://www.ruby-forum.com/t/limit-req-zone-unknown-directive/198295/1 "2010-10-29T12:34:25Z")

</div>

Hello,

i have added to my nginx.conf

http {  
limit\_req\_zone $binary\_remote\_addr zone=antiddos:10m rate=10r/s;  
}

And in my site config

location ~ .php$ {  
#limit\_req zone=antiddos burst=5;  
}

But i am only getting the error in the topic.  
Here my output of nginx -V

nginx version: nginx/0.8.53  
TLS SNI support enabled  
configure arguments: --conf-path=/etc/nginx/nginx.conf  
–error-log-path=/var/log/nginx/error.log --pid-path=/var/run/nginx.pid  
–lock-path=/var/lock/nginx.lock  
–http-log-path=/var/log/nginx/access.log  
–http-client-body-temp-path=/var/lib/nginx/body  
–http-proxy-temp-path=/var/lib/nginx/proxy  
–http-fastcgi-temp-path=/var/lib/nginx/fastcgi --with-debug  
–with-http\_stub\_status\_module --with-http\_flv\_module  
–with-http\_ssl\_module --with-http\_dav\_module  
–with-http\_stub\_status\_module  
–add-module=src/http/modules/http\_secure\_download\_module  
–add-module=src/http/modules/http\_upload\_module  
–add-module=src/http/modules/http\_uploadprogress\_module

Posted at Nginx Forum:

> **["limit\_req\_zone" unknown directive](https://forum.nginx.org/read.php?2,145619,145619#msg-145619)**
>
> Hello, i have added to my nginx.conf http { limit\_req\_zone $binary\_remote\_addr zone=antiddos:10m rate=10r/s; } And in my site config location ~ \\.php$ { #limit\_req zone=antiddos burst=5; } But i

---

<div class="post-metadata">

**Author:** ![TAiS46](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/82dd89/32.png) [@TAiS46](https://www.ruby-forum.com/u/TAiS46)\
**Post date:** [October 29, 2010, 12:56pm UTC](https://www.ruby-forum.com/t/limit-req-zone-unknown-directive/198295/2 "2010-10-29T12:56:21Z")

</div>

Hello!

On Fri, Oct 29, 2010 at 06:33:45AM -0400, TAiS46 wrote:

> }
> 
> But i am only getting the error in the topic.  
> Here my output of nginx -V

[…]

Most likely reason is that you’ve added limit\_req\_zone outside of  
http{} block. Please show full config.

Maxim D.

---

<div class="post-metadata">

**Author:** ![TAiS46](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/82dd89/32.png) [@TAiS46](https://www.ruby-forum.com/u/TAiS46)\
**Post date:** [October 29, 2010, 1:29pm UTC](https://www.ruby-forum.com/t/limit-req-zone-unknown-directive/198295/3 "2010-10-29T13:29:00Z")

</div>

## Maxim D. Wrote:

> > }  
> > […]  
> > [mailman.nginx.org archive](http://nginx.org/mailman/listinfo/nginx)  
> > user www-data;  
> > worker\_processes 16;

error\_log /var/log/nginx/error.log info;  
pid /var/run/nginx.pid;

events {  
worker\_connections 2048;  
}

http {  
client\_max\_body\_size 1600m;  
include /etc/nginx/mime.types;  
default\_type application/octet-stream;

```
access_log off;

sendfile on;
#tcp_nopush on;

keepalive_timeout 0;
#keepalive_timeout 65;
tcp_nodelay on;

gzip off;

include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;

limit_req_zone $binary_remote_addr zone=one:10m rate=10r/s;

```

}

Tanks, Simon

Posted at Nginx Forum:  
[http://forum.nginx.org/read.php?2,145619,145641#msg-145641](http://forum.nginx.org/read.php?2,145619,145641#msg-145641)

---

<div class="post-metadata">

**Author:** ![TAiS46](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/82dd89/32.png) [@TAiS46](https://www.ruby-forum.com/u/TAiS46)\
**Post date:** [October 29, 2010, 1:42pm UTC](https://www.ruby-forum.com/t/limit-req-zone-unknown-directive/198295/4 "2010-10-29T13:42:10Z")

</div>

Hello!

On Fri, Oct 29, 2010 at 07:28:07AM -0400, TAiS46 wrote:

> > > limit\_req\_zone $binary\_remote\_addr  
> > > Here my output of nginx -V  
> > > error\_log /var/log/nginx/error.log info;
> 
> ```
> include /etc/nginx/conf.d/*.conf;
> include /etc/nginx/sites-enabled/*;
> 
> limit_req_zone $binary_remote_addr zone=one:10m rate=10r/s;
> 
> ```
> 
> }

Most likely you have syntax error in one of your include files,  
e.g. extra “}” which moves limit\_req\_zone outside of http{} block.

Note well: you have to define limit\_req\_zone before you use it  
limit\_req, so after fixing syntax error you’ll see error message  
like

[emerg]: unknown limit\_req\_zone “one” in …

I.e. moving limit\_req\_zone before includes is required.

Maxim D.
