I cant use limit_conn_zone

I want to add some code to my nginx.conf , im using portable nginx php
mysql
dev stack (WT-NMP). Anyway when i add " limit_req_zone
$binary_remote_addr
zone=one:10m rate=1r/s; " in http {… , nginx is not working
correctly.
where do i go wrong, i need help. Thanks in advance

Posted at Nginx Forum:

This version from here http://nginx-win.ecsds.eu/ works with shared
memory.

Posted at Nginx Forum:

Thank your for your care but i dont understand which documentation shoul
i
read ? i entered http://nginx-win.ecsds.eu/ works but i could not find
the
documentation about limiting. Can you give me more information. I need
help.

Posted at Nginx Forum:

First of all i should say , my english not so good… And now my website
is
underattack. I have to limit.
I’m using WT-NMP to use nginx php and mysql so i should use some code in
nginx.conf. E.g I’m using “limit_rate 700k” . But i dont understand what
should i do, Please give me more information… or example. Thank you for
your patience :slight_smile:

Posted at Nginx Forum:

This has nothing to do with documentation, what you want to use does not
work with the original nginx version (shared memory) the version on the
website I’ve referred you to does work, so either forget about using
limit_conn_zone or replace your nginx version with this other version.

Posted at Nginx Forum:

Hello!

On Tue, Jul 08, 2014 at 04:05:26PM -0400, farukest wrote:

I want to add some code to my nginx.conf , im using portable nginx php mysql
dev stack (WT-NMP). Anyway when i add " limit_req_zone $binary_remote_addr
zone=one:10m rate=1r/s; " in http {… , nginx is not working correctly.
where do i go wrong, i need help. Thanks in advance

The “limit_conn_zone” creates a shared memory zone, and this
doesn’t work on Windows Vista and later due to ASLR, see here:

http://nginx.org/en/docs/windows.html#known_issues

One of possible workarounds is to start nginx with “master_process
off”, which is mostly development mode, though also allows to
address this limitation.


Maxim D.
http://nginx.org/

By the way i read this document. It says you should never use nginx in
“master_process off” mode.

http://nginx.org/en/docs/faq/daemon_master_process_off.html

Posted at Nginx Forum:

Thank you for your information. I understood what you are explaining
about.
But i heard for the first time, what is the “master_process
off” mode. How can i use it with nignx (By the way i’m using portable
nginx,php,mysql windows app). I really need help. Thanks is advance.

Posted at Nginx Forum:

Hello!

On Tue, Jul 08, 2014 at 06:48:47PM -0400, farukest wrote:

Thank you for your information. I understood what you are explaining about.
But i heard for the first time, what is the “master_process
off” mode. How can i use it with nignx (By the way i’m using portable
nginx,php,mysql windows app). I really need help. Thanks is advance.

http://nginx.org/r/master_process

Just add the directive to nginx.conf at global level.

Switching off master process means that separate master process
won’t be used, and the only process started will do all the work.
This implies various limitations (e.g., no auto respawn of dead
processes, configuration reload won’t work and so on), but also
simplifies debugging. (And it also happens to work around the
problem with shared memory on Windows.)


Maxim D.
http://nginx.org/

Hello!

On Tue, Jul 08, 2014 at 06:51:46PM -0400, farukest wrote:

By the way i read this document. It says you should never use nginx in
“master_process off” mode.

Can I run nginx with “daemon off” or “master_process off” settings in a production environment?

You should never run production on Windows anyway. If you are
going to use it for production, not for development, it’s much
better idea to change the OS in the first place.


Maxim D.
http://nginx.org/

Thank you for your care, yes I know but i have to use windows… I added
“master_process on;” to global level. There is not any problem from
here.
now how does it allow me to limit connection per ip ?

Posted at Nginx Forum:

Thank you i did what you said and it is working good. does this process
slow
down the website ? If it does, what should i do for as an alternative
speed.
Any idea ?

Posted at Nginx Forum:

Hello!

On Tue, Jul 08, 2014 at 09:12:19PM -0400, farukest wrote:

Thank you for your care, yes I know but i have to use windows… I added
“master_process on;” to global level. There is not any problem from here.
now how does it allow me to limit connection per ip ?

http://nginx.org/en/docs/http/ngx_http_limit_conn_module.html


Maxim D.
http://nginx.org/

Hello!

On Tue, Jul 08, 2014 at 09:56:52PM -0400, farukest wrote:

Thank you i did what you said and it is working good. does this process slow
down the website ? If it does, what should i do for as an alternative speed.
Any idea ?

You may want to actually read the link provided. It explains how
to configure limit_conn, what it does and what will be the
expected result. Quoting most relevant part of the limit_conn
directive docs (Module ngx_http_limit_conn_module):

: Sets the shared memory zone and the maximum allowed number of
: connections for a given key value. When this limit is exceeded,
: the server will return the 503 (Service Temporarily Unavailable)
: error in reply to a request. For example, the directives
:
: limit_conn_zone $binary_remote_addr zone=addr:10m;
:
: server {
: location /download/ {
: limit_conn addr 1;
: }
:
: allow only one connection per an IP address at a time.


Maxim D.
http://nginx.org/

Thank you for your care. It works like a charm. But sometimes page is
not
loading correctly. what is the logic of “zone=addr:10m;” and i want to
block
website entering (fast entering) and last question what location should
i
define for “wp-content/uploads/somevideo.mp4” per ip. Thanks in advance
your
help is really important for me

Posted at Nginx Forum:

I realized now, master process off is not enough to playing HD movies.
It
gives error after a while. But i want to thank you because making block
for
a while, using master process and limit_conn destroyed the attacking.
Now i
turn my nginx.conf to master_process on. Everything is alright. Thank
you
again.

Posted at Nginx Forum: