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

The httpd cookbook has been deprecated

Author provided reason for deprecation:

The httpd cookbook has been deprecated and is no longer being maintained by its authors. Use of the httpd cookbook is no longer recommended.

You may find that the apache2 cookbook is a suitable alternative.


httpd (47) Versions 0.1.6

Provides httpd_service, httpd_config, and httpd_module resources

cookbook 'httpd', '= 0.1.6', :supermarket
cookbook 'httpd', '= 0.1.6'
knife supermarket install httpd
knife supermarket download httpd
Quality 0%

HTTPD Cookbook

The HTTPD Cookbook is a "Pure Library Cookbook" (Module Cookbook?)
that provides resource primitives for use in recipes. It is designed
to be an example to reference for creating highly re-usable cross
platform cookbooks.

This cookbook does its best to follow platform native idioms at all
times. This means things like logs, pid files, sockets, and service
managers work "as expected" by an administrator familiar with a given


This cookbook is concerned with
The Apache HTTP Server, particularly those
shipped with F/OSS Unix and Linux distributions. It does not address
other httpd server implementations like Lighttpd, Nginx, or IIS.


  • Chef 11 or higher
  • Ruby 1.9 or higher (preferably from the Chef full-stack installer)



The httpd_service does minimal configuration to get the service up
and running. Its parameters can select and tune the multi-processing
module, along with a small selection of server-wide configuration
options such as listen_ports and run_user.

All other configuration options are offloaded to the user, and should
be dropped off with the httpd_config resource.

httpd_service supports multiple Apache instances on a single
machine, enabling advanced Apache configuration in scenarios where
multiple servers need different loaded modules and global


httpd_service 'default' do
  action :create

httpd_service 'instance-1' do
  listen_ports ['81', '82']
  action :create

httpd_service 'an websites' do
  instance_name 'bob'
  servername ''
  version '2.4'
  mpm 'event'
  threadlimit '4096'
  listen_ports ['1234']      
  action :create


Most of the parameters on the httpd_service resource map to their
CamelCase equivalents found at

contact - The email address rendered into the main configuration file as the ServerAdmin directive.

hostname_lookups - Enables DNS lookups on client IP addresses. Can
be 'on' 'off' or 'double'. Defaults to 'off'.

instance - A string name to identify the httpd_service instance.
By convention, this will result in configuration, log, and support
directories being created and used in the form '/etc/instance-name',
'/var/log/instance-name', etc. If set to 'default', the platform
native defaults are used.

keepalive - Enables HTTP persistent connections. Values can be true or false.

keepalivetimeout - Amount of time the server will wait for
subsequent requests on a persistent connection.

listen_addresses - IP addresses that the server listens
to. Defaults to [''].

listen_ports - Ports that the server listens
to. Defaults to ['80', '443'].

log_level - Controls the verbosity of the ErrorLog. Defaults to 'warn'.

maxclients - Maximum number of connections that will be processed
simultaneously. Valid only with prefork and worker MPMs.

maxconnectionsperchild - Limit on the number of connections that an individual child server
will handle during its life. Valid with Apache 2.4 prefork, worker and event MPMs.

maxkeepaliverequests - Number of requests allowed on a persistent
connection. Defaults to 100.

maxrequestsperchild - The Apache 2.2 version of maxconnectionsperchild. Still supported as of 2.4

maxrequestworkers - Maximum number of connections that will be
processed simultaneously. Valid on prefork, worker, and event MPMs.

maxspareservers - Maximum number of idle child server processes.
Valid only for prefork MPM.

maxsparethreads - Maximum number of idle threads. Valid only for
worker and event MPMs.

minspareservers - Minimum number of idle child server processes.
Valid only for preform MPM.

minsparethreads - Minimum number of idle threads available to handle
request spikes. Valid only for worker and event MPMs.

modules - A list of initial Apache modules to be loaded inside the
httpd_service instance. Defaults to Debian standard on 2.2 and 2.4.

mpm - The Multi-Processing Module to use for the httpd_service
instance. Values can be 'prefork', 'worker', and 'event'. Defaults to
'worker' for Apache 2.2 and 'event' for Apache 2.4.

package_name - Name of the server package to install on the machine
using the system package manager. Defaults to 'apache2' on Debian and
'httpd' on RHEL.

run_group - System group to start the httpd_service as. Defaults to
'www-data' on Debian and 'apache' on RHEL.

run_user - System user to start the httpd_service as. Defaults to
'www-data' on Debian and 'apache' on RHEL.

servername - Hostname and port that the server uses to identify
itself. Syntax: [scheme://]fully-qualified-domain-name[:port].
Defaults to node['hostname'].

startservers - Number of child server processes created at startup.
Valid for prefork, worker, and event MPMs. Default value differs from MPM to MPM.

threadlimit - Sets the upper limit on the configurable number of
threads per child process. Valid on worker and event MPMs.

threadsperchild - Number of threads created by each child process.
Valid on worker and event MPMs.

timeout - Amount of time the server will wait for certain events
before failing a request. Defaults to '400'

version - Apache software version to use. Available options are
'2.2', and '2.4', depending on platform. Defaults to latest available.


The httpd_module resource is responsible ensuring that an Apache
module is installed on the system, as well as ensuring a load configuration
snippet is dropped off at the appropriate location.


httpd_module 'ssl' do
  action :create

httpd_module 'el dap' do
  module_name 'ldap'
  action :create

httpd_module 'auth_pgsql' do
  httpd_instance 'instance-2'
  action :create


filename - The filename of the shared object to be rendered into the
load config snippet. This can usually be omitted, and defaults to a
generated value looked up in an internal map.

httpd_version - The version of the httpd_service this module is
meant to be installed for. Useful on platforms that support multiple
Apache versions. Defaults to the platform default.

instance - The httpd_service name to drop the load snippet off
for. Defaults to 'default'.

module_name - The module name to install. Defaults to the
httpd_module name.

package_name - The package name the module is found in. By default,
this is looked up in an internal map.


The httpd_config resource is a thin wrapper around the core Chef
template resource. Instead of a path parameter, httpd_config uses
the instance parameter to calculate where the config is dropped off.


httpd_config 'mysite' do
  source 'mysite.erb'
  action :create

httpd_config 'computers dot biz ssl_config' do
  config_name 'ssl-config'
  httpd_instance 'computers_dot_biz'
  source 'ssl_config.erb'
  action :create


config_name - The name of the config on disk

cookbook - The cookbook that the source template is found in. Defaults to the current cookbook.

httpd_version - Used to calculate the configuration's disk path. Defaults to the platform's native Apache version.

instance - The httpd_service instance the config is meant for. Defaults to 'default'

source - The ERB format template source used to render the file.

variables - A hash of variables passed to the underlying template resource

License & Authors

Copyright:: 2009-2014 Chef Software, 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

This cookbook has no specified dependencies.

Contingent cookbooks

yum_dag Applicable Versions

httpd Cookbook CHANGELOG

This file is used to list changes made in each version of the httpd cookbook.

v0.1.6 (2014-12-19)

  • Using "include" instead of "extend" for helper methods

v0.1.5 (2014-08-24)

  • Adding a modules parameter to httpd_service resource. It now loads a base set of modules by default

v0.1.4 (2014-08-23)

  • Renaming magic to mime.types

v0.1.3 (2014-08-22)

  • Fixing notifications by using LWRP DSL actions

v0.1.2 (2014-08-22)

  • Fixing up maxkeepaliverequests in template

v0.1.1 (2014-08-22)

  • Fixing up maxkeepaliverequests parameter

v0.1.0 (2014-08-22)

  • Initial Beta release. Let the bug hunts begin!

Foodcritic Metric

0.1.6 failed this metric

FC005: Avoid repetition of resource declarations: /tmp/cook/5fe74b5c0e1e26d6d901c8f7/httpd/libraries/provider_httpd_service_rhel.rb:54
FC023: Prefer conditional attributes: /tmp/cook/5fe74b5c0e1e26d6d901c8f7/httpd/libraries/provider_httpd_service_debian.rb:307
FC023: Prefer conditional attributes: /tmp/cook/5fe74b5c0e1e26d6d901c8f7/httpd/libraries/provider_httpd_service_rhel.rb:242