From 557bba90d4f89e2230026c104874baa23ebf69d1 Mon Sep 17 00:00:00 2001 From: FTB_lag Date: Sun, 1 Sep 2024 15:49:47 +0300 Subject: [PATCH] feat: support disabling "worker_rlimit_nofile" --- spec/classes/nginx_spec.rb | 6 ++++++ templates/conf.d/nginx.conf.erb | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/spec/classes/nginx_spec.rb b/spec/classes/nginx_spec.rb index 016dbdf45..c6b61bc19 100644 --- a/spec/classes/nginx_spec.rb +++ b/spec/classes/nginx_spec.rb @@ -447,6 +447,12 @@ value: 10_000, match: 'worker_rlimit_nofile 10000;' }, + { + title: 'should not set worker_rlimit_nofile', + attr: 'worker_rlimit_nofile', + value: 0, + notmatch: %r{worker_rlimit_nofile} + }, { title: 'should set pcre_jit', attr: 'pcre_jit', diff --git a/templates/conf.d/nginx.conf.erb b/templates/conf.d/nginx.conf.erb index 5fa31c3c9..dfa7e0820 100644 --- a/templates/conf.d/nginx.conf.erb +++ b/templates/conf.d/nginx.conf.erb @@ -13,7 +13,7 @@ daemon <%= @daemon %>; user <%= @daemon_user %><% if @daemon_group -%> <%= @daemon_group %><% end -%>; <% end -%> worker_processes <%= @worker_processes %>; -<% if @worker_rlimit_nofile -%> +<% if @worker_rlimit_nofile > 0 -%> worker_rlimit_nofile <%= @worker_rlimit_nofile %>; <% end -%> <% if @pcre_jit -%>