Adoptable Cookbooks List

Looking for a cookbook to adopt? You can now see a list of cookbooks available for adoption!
List of Adoptable Cookbooks

Supermarket Belongs to the Community

Supermarket belongs to the community. While Chef has the responsibility to keep it running and be stewards of its functionality, what it does and how it works is driven by the community. The chef/supermarket repository will continue to be where development of the Supermarket application takes place. Come be part of shaping the direction of Supermarket by opening issues and pull requests or by joining us on the Chef Mailing List.

Select Badges

Select Supported Platforms

Select Status


nginx (112) Versions 0.101.4

Installs and configures nginx

cookbook 'nginx', '= 0.101.4', :supermarket
cookbook 'nginx', '= 0.101.4'
knife supermarket install nginx
knife supermarket download nginx
Quality -%


Installs nginx from package OR source code and sets up configuration handling similar to Debian's Apache2 scripts.



  • build-essential (for nginx::source)
  • runit (for nginx::source)
  • ohai (for nginx::ohai_plugin)


  • Debian/Ubuntu
  • RHEL/CentOS

The nginx::source may work anywhere "build-essential" is avaialble. The EPEL repo is required for nginx::default on RedHat family distros.


Node attributes for this cookbook are logically separated into
different files. Some attributes are set only via a specific recipe.


Generally used attributes. Some have platform specific values. See attributes/default.rb. "The Config" refers to "nginx.conf" the main config file.

v0.101.0 - Attribute Change: node['nginx']['url'] is now node['nginx']['source']['url'] as the URL was only used when retrieving the source to build Nginx.

  • node['nginx']['dir'] - Location for Nginx configuration.
  • node['nginx']['log_dir'] - Location for Nginx logs.
  • node['nginx']['user'] - User that Nginx will run as.
  • node['nginx']['binary'] - Path to the Nginx binary.
  • node['nginx']['init_style'] - How to run Nginx as a service when using nginx::source. Values can be "runit", "init" or "bluepill". When using runit or bluepill, those recipes will be included as well and are dependencies of this cookbook. Not used in the nginx recipe because the package manager's init script style for the platform is assumed.
  • node['nginx']['pid'] - Location of the PID file.
  • node['nginx']['keepalive'] - Whether to use keepalive_timeout, any value besides "on" will leave that option out of the config.
  • node['nginx']['keepalive_timeout'] - used for config value of keepalive_timeout.
  • node['nginx']['worker_processes'] - used for config value of worker_processes.
  • node['nginx']['worker_connections'] - used for config value of events { worker_connections }
  • node['nginx']['server_names_hash_bucket_size'] - used for config value of server_names_hash_bucket_size.
  • node['nginx']['disable_access_log'] - set to true to disable the general access log, may be useful on high traffic sites.

Attributes for configuring the gzip module

  • node['nginx']['gzip'] - Whether to use gzip, can be "on" or "off"
  • node['nginx']['gzip_http_version'] - used for config value of gzip_http_version.
  • node['nginx']['gzip_comp_level'] - used for config value of gzip_comp_level.
  • node['nginx']['gzip_proxied'] - used for config value of gzip_proxied.
  • node['nginx']['gzip_types'] - used for config value of gzip_types - must be an Array.

Attributes set in recipes


  • node['nginx']['daemon_disable'] - Whether the daemon should be disabled which can be true or false; disable the daemon (run in the foreground) when using a service supervisor such as runit or bluepill for "init_style". This is automatically set in the nginx::source recipe when the init style is not bluepill or runit.


  • node['nginx']['remote_ip_var'] - The remote ip variable name to use.
  • node['nginx']['authorized_ips'] - IPs authorized by the module



  • node['nginx']['realip']['header'] - Header to use for the RealIp Module; only accepts "X-Forwarded-For" or "X-Real-IP"
  • node['nginx']['realip']['addresses'] - Addresses to use for the http_realip configuration.


These attributes are used in the nginx::source recipe. Some of them are dynamically modified during the run. See attributes/source.rb for default values.

  • node['nginx']['source']['url'] - (versioned) URL for the Nginx source code. By default this will use the version specified as `node['nginx']['version'].
  • node['nginx']['source']['prefix'] - (versioned) prefix for installing nginx from source
  • node['nginx']['source']['conf_path'] - location of the main config file, in node['nginx']['dir'] by default.
  • node['nginx']['source']['modules'] - Array of modules that should be compiled into Nginx by including their recipes in nginx::source.
  • node['nginx']['source']['default_configure_flags'] - The default flags passed to the configure script when building Nginx.
  • node['nginx']['configure_flags'] - Preserved for compatibility and dynamically generated from the node['nginx']['source']['default_configure_flags'] in the nginx::source recipe.


These attributes are used in the nginx::http_geoip_module recipe.

  • node['nginx']['geoip']['path'] - Location where to install the geoip libraries.
  • node['nginx']['geoip']['enable_city'] - Whether to enable City data
  • node['nginx']['geoip']['country_dat_url'] - Country data tarball URL
  • node['nginx']['geoip']['country_dat_checksum'] - Country data tarball checksum
  • node['nginx']['geoip']['city_dat_url'] - City data tarball URL
  • node['nginx']['geoip']['city_dat_checksum'] - City data tarball checksum
  • node['nginx']['geoip']['lib_version'] - Version of the GeoIP library to install
  • node['nginx']['geoip']['lib_url'] - (Versioned) Tarball URL of the GeoIP library
  • node['nginx']['geoip']['lib_checksum'] - Checksum of the GeoIP library tarball


These attributes are used in the nginx::upload_progress_module recipe.

  • node['nginx']['upload_progress]['url'] - URL for the tarball.
  • node['nginx']['upload_progress']['checksum'] - Checksum of the tarball.


This cookbook provides two main recipes for installing Nginx.

  • default.rb: Use this recipe if you have a native package for Nginx.
  • source.rb: Use this recipe if you do not have a native package for Nginx, or if you want to install a newer version than is available, or if you have custom module compilation needs.

Several recipes are related to the source recipe specifically. See that recipe's section below for a description.


The default recipe will install Nginx as a native package for the system through the package manager and sets up the configuration according to the Debian site enable/disable style with sites-enabled using the nxensite and nxdissite scripts. The nginx service will be managed with the normal init scripts that are presumably included in the native package.

Includes the ohai_plugin recipe so the plugin is available.


This recipe provides an Ohai plugin as a template. It is included by both the default and source recipes.


Sets up configuration for the authorized_ip nginx module.


This recipe is responsible for building Nginx from source. It ensures that the required packages to build Nginx are installed (pcre, openssl, compile tools). The source will be downloaded from the node['nginx']['source']['url']. The node['nginx']['user'] will be created as a system user. The appropriate configuration and log directories and config files will be created as well according to the attributes node['nginx']['dir'] and 'node['nginx']['log_dir']`.

The recipe attempts to detect whether additional modules should be added to the configure command through recipe inclusion (see below), and whether the version or configuration flags have changed and should trigger a recompile.

The nginx service will be set up according to node['nginx']['init_style']. Available options are:

  • runit: uses runit cookbook and sets up runit_service.
  • bluepill: uses bluepill cookbook and sets up bluepill_service.
  • anything else (e.g., "init") will use the nginx init script template.

RHEL/CentOS This recipe should work on RHEL/CentOS with "init" as the init style.

The following recipes are used to build module support into Nginx:

  • http_geoip_module.rb - installs the GeoIP libraries and data files and enables the module for compilation.
  • http_gzip_static_module.rb - enables the module for compilation.
  • http_realip_module.rb - enables the module for compilation and creates the configuration.
  • http_ssl_module.rb - enables SSL for compilation.
  • http_stub_status_module.rb - provides nginx_status configuration and enables the module for compilation.
  • upload_progress_module.rb - builds the upload_progress module and enables it as a module when compiling nginx.

Ohai Plugin

The ohai_plugin recipe includes an Ohai plugin. It will be automatically installed and activated, providing the following attributes via ohai, no matter how nginx is installed (source or package):

  • node['nginx']['version'] - version of nginx
  • node['nginx']['configure_arguments'] - options passed to ./configure when nginx was built
  • node['nginx']['prefix'] - installation prefix
  • node['nginx']['conf_path'] - configuration file path

In the source recipe, it is used to determine whether control attributes for building nginx have changed.


Include the recipe on your node or role that fits how you wish to install Nginx on your system per the recipes section above. Modify the attributes as required in your role to change how various configuration is applied per the attributes section above. In general, override attributes in the role should be used when changing attributes.

There's some redundancy in that the config handling hasn't been separated from the installation method (yet), so use only one of the recipes, default or source.

License and Author

Author:: Joshua Timberman (
Author:: Adam Jacob (
Author:: AJ Christensen (
Author:: Jamie Winsor (

Copyright:: 2008-2012, Opscode, Inc

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
See the License for the specific language governing permissions and
limitations under the License.

Dependent cookbooks

build-essential >= 0.0.0
runit >= 0.0.0
bluepill >= 0.0.0
yum >= 0.0.0
ohai ~> 1.0.2

Contingent cookbooks

aegir Applicable Versions
aegir3 Applicable Versions
alfresco-webserver Applicable Versions
app Applicable Versions
application_nginx Applicable Versions
application_static Applicable Versions
archiva Applicable Versions
base_image Applicable Versions
berkshelf Applicable Versions
berkshelf-api-server Applicable Versions
berkshelf-api-server-ya Applicable Versions
boxbilling Applicable Versions
cabot Applicable Versions
cassandra-opscenter Applicable Versions
certbot Applicable Versions
chef-jellyfish Applicable Versions
chef-server Applicable Versions
cloudfoundry-cloud_controller Applicable Versions
cloudfoundry-nginx Applicable Versions
config-driven-helper Applicable Versions
cyclesafe_chef Applicable Versions
devpi Applicable Versions
docker-registry2 Applicable Versions
dokku Applicable Versions
drone Applicable Versions
elasticsearch_cluster Applicable Versions
elkstack Applicable Versions
errbit Applicable Versions
etherpad-lite Applicable Versions
eulipion-slate Applicable Versions
fanfare Applicable Versions
frog Applicable Versions
gem_server Applicable Versions
geminabox Applicable Versions
gemirro Applicable Versions
ghost Applicable Versions
github_connector Applicable Versions
gitlab Applicable Versions
gitlab-server Applicable Versions
gitpaste Applicable Versions
grafana Applicable Versions
huginn Applicable Versions
ice Applicable Versions
insight Applicable Versions
iptables_web Applicable Versions
ipynb Applicable Versions
ish Applicable Versions
jenkins Applicable Versions
jenkins-server Applicable Versions
kibana5-gm Applicable Versions
kibana_lwrp Applicable Versions
kloudspeaker Applicable Versions
kong Applicable Versions
lemur Applicable Versions
looker Applicable Versions
lxc-web-panel Applicable Versions
magento Applicable Versions
maven-deploy Applicable Versions
mediacore Applicable Versions
met-jenkins Applicable Versions
mirage Applicable Versions
modcloth-hubot Applicable Versions
moodle Applicable Versions
mozilla-firefox-sync Applicable Versions
mozilla-sync Applicable Versions
mruby Applicable Versions
munin Applicable Versions
myusa Applicable Versions
nagios Applicable Versions
nexus Applicable Versions
nginx-hardening Applicable Versions
nginx-proxy Applicable Versions
nginx_conf Applicable Versions
nginx_fallback_to_apache Applicable Versions
nginx_simplecgi Applicable Versions
nginxsite Applicable Versions
ngx Applicable Versions
nodejs-deploy Applicable Versions
nodestack Applicable Versions
noosfero Applicable Versions
oc-id Applicable Versions
ohmage Applicable Versions
omakase Applicable Versions
opennms Applicable Versions
opsworks_ruby Applicable Versions
owncloud Applicable Versions
paramount Applicable Versions
passenger_enterprise Applicable Versions
phabricator Applicable Versions
phpstack Applicable Versions
pita Applicable Versions
piwik Applicable Versions
postfixadmin Applicable Versions
prose Applicable Versions
pythonstack Applicable Versions
rackbox Applicable Versions
rackspace_nginx_php Applicable Versions
rails_application Applicable Versions
railsbox Applicable Versions
redirect Applicable Versions
redmine2 Applicable Versions
reprepro Applicable Versions
request_tracker Applicable Versions
roundcube Applicable Versions
rubycas Applicable Versions
rundeck-alt Applicable Versions
sensu_admin Applicable Versions
sinatra Applicable Versions
snipe-it Applicable Versions
spree Applicable Versions
stack_commons Applicable Versions
storj Applicable Versions
strongloop Applicable Versions
sudo_consul Applicable Versions
supermarket Applicable Versions
symfony Applicable Versions
teleport-le Applicable Versions
thumbor Applicable Versions
thumbor_ng Applicable Versions
webapp Applicable Versions
wordpress Applicable Versions
ya-piwik Applicable Versions
zabbix Applicable Versions
zabbix_lwrp Applicable Versions
zammad Applicable Versions

No quality metric results found