Browse Source

nginx: do not reduce max processes

Use the upstream value for NGX_MAX_PROCESSES (=1024) again.
So it is safe to use `worker_processes auto;` (which sets it to
the number of CPUs). Also use this directive in the conf instead
of calculating the number in the init and passing it as argument.

Signed-off-by: Peter Stadler <peter.stadler@student.uibk.ac.at>
lilik-openwrt-22.03
Peter Stadler 5 years ago
parent
commit
62609f1587
4 changed files with 4 additions and 14 deletions
  1. +1
    -1
      net/nginx/Makefile
  2. +2
    -0
      net/nginx/files/nginx.conf
  3. +1
    -2
      net/nginx/files/nginx.init
  4. +0
    -11
      net/nginx/patches/300-max-processes.patch

+ 1
- 1
net/nginx/Makefile View File

@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=nginx PKG_NAME:=nginx
PKG_VERSION:=1.17.10 PKG_VERSION:=1.17.10
PKG_RELEASE:=2
PKG_RELEASE:=3
PKG_SOURCE:=nginx-$(PKG_VERSION).tar.gz PKG_SOURCE:=nginx-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://nginx.org/download/ PKG_SOURCE_URL:=https://nginx.org/download/


+ 2
- 0
net/nginx/files/nginx.conf View File

@ -1,6 +1,8 @@
# Please consider creating files in /etc/nginx/conf.d/ instead of editing this. # Please consider creating files in /etc/nginx/conf.d/ instead of editing this.
# For details see https://openwrt.org/docs/guide-user/services/webserver/nginx # For details see https://openwrt.org/docs/guide-user/services/webserver/nginx
worker_processes auto;
user root; user root;
events {} events {}


+ 1
- 2
net/nginx/files/nginx.init View File

@ -16,9 +16,8 @@ start_service() {
${NGINX_UTIL} init_lan ${NGINX_UTIL} init_lan
procd_open_instance procd_open_instance
NCPUS="$(grep -c '^processor\s*:' /proc/cpuinfo)"
procd_set_param command /usr/sbin/nginx -c "${NGINX_CONF}" \ procd_set_param command /usr/sbin/nginx -c "${NGINX_CONF}" \
-g "daemon off; worker_processes $NCPUS;"
-g "daemon off;"
procd_set_param stdout 1 procd_set_param stdout 1
procd_set_param stderr 1 procd_set_param stderr 1
procd_set_param file "${LAN_LISTEN}" "${LAN_LISTEN}.default" \ procd_set_param file "${LAN_LISTEN}" "${LAN_LISTEN}.default" \


+ 0
- 11
net/nginx/patches/300-max-processes.patch View File

@ -1,11 +0,0 @@
--- a/src/os/unix/ngx_process.h
+++ b/src/os/unix/ngx_process.h
@@ -44,7 +44,7 @@ typedef struct {
} ngx_exec_ctx_t;
-#define NGX_MAX_PROCESSES 1024
+#define NGX_MAX_PROCESSES 8
#define NGX_PROCESS_NORESPAWN -1
#define NGX_PROCESS_JUST_SPAWN -2

Loading…
Cancel
Save