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 -%>