Skip to content

Commit 2baa5be

Browse files
committed
Remove keepalive, update the number of FDs available to be twice the number of workers
1 parent 50fc159 commit 2baa5be

File tree

5 files changed

+5
-5
lines changed

5 files changed

+5
-5
lines changed

Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ ENV STATIC_LOCATIONS=
1616
ENV NO_ACCESS_LOGS=0
1717
ENV LOG_ONLY_5XX=0
1818
ENV WORKER_CONNECTIONS=1024
19+
1920
EXPOSE 80
2021
STOPSIGNAL SIGQUIT
2122
ENTRYPOINT ["/docker-entrypoint.sh"]

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ Pair nginx-proxy with your favorite upstream server (wsgi, uwsgi, asgi, et al.)
2828
| `NO_ACCESS_LOGS` | disable access logs completely | No | 0 | 1 |
2929
| `LOG_ONLY_5XX` | only log 5XX HTTP status access events | No | 0 | 1 |
3030
| `WORKER_CONNECTIONS` | Set the number of allowed worker connections | No | 1024 | 2048 |
31+
| `WORKER_FILE_LIMIT` | Set the number of available file descripters | No | 2*WORKER_CONNECTIONS | 4096 |
3132

3233
### Hosting Static Assets
3334

src/docker-entrypoint.d/00-render-templates.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ function render_templates {
1616
done
1717
}
1818

19+
export WORKER_FILE_LIMIT=${WORKER_FILE_LIMIT:=$(( WORKER_CONNECTIONS * 2 ))}
20+
1921
render_templates "/etc/nginx/*.template" "/etc/nginx"
2022
render_templates "/etc/nginx/conf.d/*.template" "/etc/nginx/conf.d"
2123
render_templates "/etc/nginx/includes/*.template" "/etc/nginx/includes"

src/etc/nginx/conf.d/default.conf.template

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ server {
1010

1111
upstream app {
1212
server {{ .Env.UPSTREAM_SERVER }};
13-
14-
keepalive 8; # The maximum number of idle keepalive connections to upstream servers.
1513
}
1614

1715
server {
@@ -24,9 +22,6 @@ server {
2422
add_header X-XSS-Protection "1; mode=block";
2523
add_header X-Content-Type-Options "nosniff";
2624

27-
proxy_http_version 1.1;
28-
proxy_set_header "Connection" "";
29-
3025
location / {
3126
{{ if (eq .Env.PROXY_UWSGI "1") }}
3227
include /etc/nginx/includes/uwsgi.conf;

src/etc/nginx/nginx.conf.template

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ pid /var/run/nginx.pid;
77
# Used to zap Server header
88
load_module /usr/lib/nginx/modules/ngx_http_headers_more_filter_module.so;
99

10+
worker_rlimit_nofile {{ .Env.WORKER_FILE_LIMIT }};
1011
events {
1112
worker_connections {{ .Env.WORKER_CONNECTIONS }};
1213
use epoll;

0 commit comments

Comments
 (0)