chef-cookbooks/nginx

Name: nginx

Owner: Chef Community Cookbooks

Description: Development repository for nginx cookbook

Created: 2012-03-14 18:35:37.0

Updated: 2018-01-10 21:01:42.0

Pushed: 2018-01-05 15:29:47.0

Homepage: https://supermarket.chef.io/cookbooks/nginx

Size: 1142

Language: Ruby

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

nginx Cookbook

Cookbook Build Status

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

Requirements
Cookbooks

The following cookbooks are direct dependencies because they're used for common “default” functionality.

Platforms

The following platforms are supported and tested with Test Kitchen:

Other Debian and RHEL family distributions are assumed to work.

Chef
Attributes

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

nginx::auth_request

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

nginx::default

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

authorized_ips module gzip module Other configurations
nginx::devel

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

nginx::echo

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

nginx::geoip

These attributes are used in the nginx::http_geoip_module recipe. Please note that the country_dat_checksum and city_dat_checksum are based on downloads from a datacenter in Fremont, CA, USA. You really should override these with checksums for the geo tarballs from your node location.

Note The upstream, maxmind.com, may block access for repeated downloads of the data files. It is recommended that you download and host the data files, and change the URLs in the attributes.

nginx::http_realip_module

From: http://nginx.org/en/docs/http/ngx_http_realip_module.html

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):

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

nginx::openssl_source

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

nginx::passenger

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

Basic configuration to use the official Phusion Passenger repositories:

nginx::rate_limiting
nginx::repo
nginx::socketproxy

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

nginx::source

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.

nginx::status

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

nginx::syslog

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

nginx::upload_progress

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

Resources
nginx_site

Enable or disable a Server Block in #{node['nginx']['dir']}/sites-available by calling nxensite or nxdissite (introduced by this cookbook) to manage the symbolic link in #{node['nginx']['dir']}/sites-enabled.

Actions
Properties:
nginx_cleanup_runit

A simple resource to remove existing runit based nginx service installations. This is used in the default nginx recipe to stop runit based nginx services and cleanup runit service configs before setting up nginx under the system's own init system.

Actions
Usage

This cookbook provides three distinct installation methods, all of which are controlled via attributes and executed using the nginx::default recipe.

Package installation using the nginx.org repositories

Nginx provides repositories for RHEL, Debian/Ubuntu, and Suse platforms with up to date packages available on older distributions. Due to the age of many nginx packages shipping with distros we believe this is the ideal installation method. With no attributes set the nginx.org repositories will be added to your system and nginx will be installed via package. This provides a solid out of the box install for most users.

Package installation using distro repositories

If you prefer to use the packages included in your distro or to roll your own packages you'll want to set node['nginx']['repo_source'] to nil or distro to skip the repository setup. The default recipe will still install nginx from packages, but you'll retain control over the package location.

Source installation to compile non-dynamic modules

If you need control over how nginx is built, or you need non-dynamic modules to be included you'll need to compile nginx from source. We highly recommend against using this method as it requires the installation of a full compilation toolchain and development dependencies on your nodes. Creating your own packages with nginx compiled as necessary is a preferred option. If that's not possible you can set node['nginx']['install_method'] to source and provide a version in node['nginx']['version'].

Specifying Modules to compile

The following recipes are used to build module support into nginx. To compile a module, add its recipe name to the array attribute node['nginx']['source']['modules'].

Resources
nginx_site

Enable or disable a Server Block in #{node['nginx']['dir']}/sites-available by calling nxensite or nxdissite (introduced by this cookbook) to manage the symbolic link in #{node['nginx']['dir']}/sites-enabled.

Actions
Properties:
Adding New Modules

Previously we'd add each possible module to this cookbook itself. That's not necessary using wrapper cookbooks and we'd prefer to not add any addition module recipes at this time. Instead in your nginx wrapper cookbook setup any necessary packages and then include the follow code to add the module to the list of modules to compile:

.run_state['nginx_configure_flags'] =
de.run_state['nginx_configure_flags'] | ['--with-SOMETHING', "--with-SOME_OPT='things'"]
Maintainers

This cookbook is maintained by Chef's Community Cookbook Engineering team. Our goal is to improve cookbook quality and to aid the community in contributing to cookbooks. To learn more about our team, process, and design goals see our team documentation. To learn more about contributing to cookbooks like this see our contributing documentation, or if you have general questions about this cookbook come chat with us in #cookbok-engineering on the Chef Community Slack

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

http://www.apache.org/licenses/LICENSE-2.0

ss required by applicable law or agreed to in writing, software
ributed under the License is distributed on an "AS IS" BASIS,
OUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
the License for the specific language governing permissions and
tations under the License.

This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.