[GH-ISSUE #780] Support for limiting number of connections #659

Closed
opened 2026-02-26 06:33:53 +03:00 by kerem · 5 comments
Owner

Originally created by @wpresident on GitHub (Dec 18, 2020).
Original GitHub issue: https://github.com/NginxProxyManager/nginx-proxy-manager/issues/780

I need limit max connection speed for clients and i try this lines for my config:

limit_conn perip 1;
limit_rate 10240k;
limit_conn perserver 30;

When i insert it to
server {
then server can't start and shows error:

[nginx] starting...
nginx: [emerg] zero size shared memory zone "perip"
[12/18/2020] [11:51:44 AM] [SSL ] › ✖ error Error: Command failed: /usr/sbin/nginx -t

nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: [emerg] zero size shared memory zone "perip"
nginx: configuration file /etc/nginx/nginx.conf test failed


at ChildProcess.exithandler (child_process.js:303:12)
at ChildProcess.emit (events.js:315:20)
at maybeClose (internal/child_process.js:1021:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
[nginx] starting...
nginx: [emerg] zero size shared memory zone "perip"
[nginx] starting...
nginx: [emerg] zero size shared memory zone "perip"
[nginx] starting...
nginx: [emerg] zero size shared memory zone "perip"
[nginx] starting...
nginx: [emerg] zero size shared memory zone "perip"
[nginx] starting...
nginx: [emerg] zero size shared memory zone "perip"
[nginx] starting...

How to user this properly with NPM?

Originally created by @wpresident on GitHub (Dec 18, 2020). Original GitHub issue: https://github.com/NginxProxyManager/nginx-proxy-manager/issues/780 I need limit max connection speed for clients and i try this lines for my config: ``` limit_conn perip 1; limit_rate 10240k; limit_conn perserver 30; ``` When i insert it to `server {` then server can't start and shows error: ``` [nginx] starting... nginx: [emerg] zero size shared memory zone "perip" [12/18/2020] [11:51:44 AM] [SSL ] › ✖ error Error: Command failed: /usr/sbin/nginx -t nginx: the configuration file /etc/nginx/nginx.conf syntax is ok nginx: [emerg] zero size shared memory zone "perip" nginx: configuration file /etc/nginx/nginx.conf test failed at ChildProcess.exithandler (child_process.js:303:12) at ChildProcess.emit (events.js:315:20) at maybeClose (internal/child_process.js:1021:16) at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5) [nginx] starting... nginx: [emerg] zero size shared memory zone "perip" [nginx] starting... nginx: [emerg] zero size shared memory zone "perip" [nginx] starting... nginx: [emerg] zero size shared memory zone "perip" [nginx] starting... nginx: [emerg] zero size shared memory zone "perip" [nginx] starting... nginx: [emerg] zero size shared memory zone "perip" [nginx] starting... ``` How to user this properly with NPM?
kerem 2026-02-26 06:33:53 +03:00
Author
Owner

@thytetgc commented on GitHub (Mar 15, 2021):

I need limit max connection speed for clients and i try this lines for my config:

limit_conn perip 1;
limit_rate 10240k;
limit_conn perserver 30;

When i insert it to
server {
then server can't start and shows error:

[nginx] starting...
nginx: [emerg] zero size shared memory zone "perip"
[12/18/2020] [11:51:44 AM] [SSL ] › ✖ error Error: Command failed: /usr/sbin/nginx -t

nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: [emerg] zero size shared memory zone "perip"
nginx: configuration file /etc/nginx/nginx.conf test failed


at ChildProcess.exithandler (child_process.js:303:12)
at ChildProcess.emit (events.js:315:20)
at maybeClose (internal/child_process.js:1021:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
[nginx] starting...
nginx: [emerg] zero size shared memory zone "perip"
[nginx] starting...
nginx: [emerg] zero size shared memory zone "perip"
[nginx] starting...
nginx: [emerg] zero size shared memory zone "perip"
[nginx] starting...
nginx: [emerg] zero size shared memory zone "perip"
[nginx] starting...
nginx: [emerg] zero size shared memory zone "perip"
[nginx] starting...

How to user this properly with NPM?

limit_rate is working fine!

But connection limit does not work!

It would be very good if there is support for

https://github.com/cfsego/limit_upload_rate

<!-- gh-comment-id:799810134 --> @thytetgc commented on GitHub (Mar 15, 2021): > I need limit max connection speed for clients and i try this lines for my config: > > ``` > limit_conn perip 1; > limit_rate 10240k; > limit_conn perserver 30; > ``` > > When i insert it to > `server {` > then server can't start and shows error: > > ``` > [nginx] starting... > nginx: [emerg] zero size shared memory zone "perip" > [12/18/2020] [11:51:44 AM] [SSL ] › ✖ error Error: Command failed: /usr/sbin/nginx -t > > nginx: the configuration file /etc/nginx/nginx.conf syntax is ok > nginx: [emerg] zero size shared memory zone "perip" > nginx: configuration file /etc/nginx/nginx.conf test failed > > > at ChildProcess.exithandler (child_process.js:303:12) > at ChildProcess.emit (events.js:315:20) > at maybeClose (internal/child_process.js:1021:16) > at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5) > [nginx] starting... > nginx: [emerg] zero size shared memory zone "perip" > [nginx] starting... > nginx: [emerg] zero size shared memory zone "perip" > [nginx] starting... > nginx: [emerg] zero size shared memory zone "perip" > [nginx] starting... > nginx: [emerg] zero size shared memory zone "perip" > [nginx] starting... > nginx: [emerg] zero size shared memory zone "perip" > [nginx] starting... > ``` > > How to user this properly with NPM? limit_rate is working fine! But connection limit does not work! It would be very good if there is support for https://github.com/cfsego/limit_upload_rate
Author
Owner

@chaptergy commented on GitHub (May 12, 2021):

See https://github.com/jc21/nginx-proxy-manager/issues/116

<!-- gh-comment-id:840116734 --> @chaptergy commented on GitHub (May 12, 2021): See https://github.com/jc21/nginx-proxy-manager/issues/116
Author
Owner

@mgutt commented on GitHub (May 18, 2023):

limit_rate is working fine!

Does it? I tested the following code, but it has no effect 😢

location / {
  # limit download speed
  if ($request_method = GET ) {
    add_header Strict-Transport-Security "max-age=16552000; includeSubdomains; preload;";
    #  only for files bigger than 10MB
    limit_rate_after 10000k;
    # set speed to 10 MBit/s
    limit_rate 1250k;
  }

I even tested only limit_rate 1250k; outside the location block (= server block), but still no bandwidth limitation while downloading files 🤔

PS the Strict-Transport-Security header is set, so the condition works.

<!-- gh-comment-id:1553291424 --> @mgutt commented on GitHub (May 18, 2023): > limit_rate is working fine! Does it? I tested the following code, but it has no effect 😢 ``` location / { # limit download speed if ($request_method = GET ) { add_header Strict-Transport-Security "max-age=16552000; includeSubdomains; preload;"; # only for files bigger than 10MB limit_rate_after 10000k; # set speed to 10 MBit/s limit_rate 1250k; } ``` I even tested only `limit_rate 1250k;` outside the location block (= server block), but still no bandwidth limitation while downloading files 🤔 PS the `Strict-Transport-Security` header is set, so the condition works.
Author
Owner

@github-actions[bot] commented on GitHub (Mar 22, 2024):

Issue is now considered stale. If you want to keep it open, please comment 👍

<!-- gh-comment-id:2014167402 --> @github-actions[bot] commented on GitHub (Mar 22, 2024): Issue is now considered stale. If you want to keep it open, please comment :+1:
Author
Owner

@github-actions[bot] commented on GitHub (May 3, 2025):

Issue was closed due to inactivity.

<!-- gh-comment-id:2848367645 --> @github-actions[bot] commented on GitHub (May 3, 2025): Issue was closed due to inactivity.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/nginx-proxy-manager-NginxProxyManager#659
No description provided.