config

January 27, 2026 ยท View on GitHub

Back to resource list

Actions

  • :create
  • :delete

Properties

NameTypeDefaultDescription
config_fileString/etc/nginx/nginx.confThe full path to the Nginx server configuration on disk.
conf_cookbookStringnginxWhich cookbook to use for the configuration template.
conf_templateStringnginx.conf.erbWhich template to use for the configuration file.
conf_variablesHash{}Additional variables to include in conf template.
portInteger, String80Port to listen on.
server_nameStringnode['hostname']Sets the server_name directive.
ownerStringrootNginx file/folder owner.
groupStringrootNginx run-as/file/folder group.
modeString0640Nginx configuration file mode.
folder_modeString0750Nginx configuration folder mode.
log_dir_modeString0755Nginx log directory mode.
log_dir_ownerStringrootNginx log directory owner.
log_dir_groupStringrootNginx log directory group.
process_userStringwww-data (Debian) or nginxNginx run-as user.
process_groupStringwww-data (Debian) or nginxNginx run-as group.
worker_processesInteger, StringautoThe number of worker processes.
worker_connectionsInteger, String1_024The maximum number of simultaneous connections that can be opened by a worker process.
sendfileStringonEnables or disables the use of sendfile().
tcp_nopushStringonEnables or disables the use of the TCP_CORK socket option on Linux.
tcp_nodelayStringonEnables or disables the use of the TCP_NODELAY option.
keepalive_timeoutInteger, String65Timeout during which a keep-alive client connection will stay open on the server side.
types_hash_max_sizeInteger, String2_048Sets the maximum size of the types hash tables.on Linux.
default_site_enabledTrue, FalsetrueWhether or not the default site is enabled.
default_site_cookbookStringnginxWhich cookbook to use for the default site template.
default_site_templateStringdefault-site.erbWhich template to use for the default site.
template_helpersString, ArraynilAdditional helper modules to include in the default site and config template.

Examples

nginx_config 'nginx' do
  action :create
  notifies :reload, 'nginx_service[nginx]', :delayed
end

Using custom log directory permissions

nginx_config 'nginx' do
  log_dir_mode '0750'
  log_dir_owner 'nginx'
  log_dir_group 'nginx'
  action :create
  notifies :reload, 'nginx_service[nginx]', :delayed
end