Manage the Apache httpd web server and its configuration with snippets.

Matthias Saou



32,821 latest version

3.1 quality score

Version information

  • 1.0.0 (latest)
  • 0.5.0
  • 0.4.2
  • 0.4.1
  • 0.3.2
  • 0.3.1
  • 0.3.0
released Apr 28th 2015
This version is compatible with:
  • Puppet >=2.7.20 <4.1.0
  • RedHat

Start using this module

Tags: apache, web, httpd


thias/apache_httpd — version 1.0.0 Apr 28th 2015

puppet apache_httpd


Install the Apache HTTP daemon and manage its main configuration as well as additional configuration snippets.

The module is very Red Hat Enterprise Linux focused, as the defaults try to change everything in ways which are typical for RHEL.

  • apache_httpd : Main class for the server and its main configuration.
  • apache_httpd::file : Definition to manage additional configuration files.

This module disables TRACE and TRACK methods by default, which is best practice (using rewrite rules, so only when it is enabled).


Sripped down instance running as the git user for the cgit cgi :

class { 'apache_httpd':
  mpm       => 'worker',
  modules   => [ 'mime', 'setenvif', 'alias', 'proxy', 'cgi' ],
  keepalive => 'On',
  user      => 'git',
  group     => 'git',

Complete instance with https, a typical module list ready for php and the original Red Hat welcome page disabled :

apache_httpd { 'prefork':
  ssl     => true,
  modules => [
  welcome => false,

Example entry for hiera to change some of the defaults globally :

apache_httpd::extendedstatus: 'On'
apache_httpd::serveradmin: 'root@example.com'
apache_httpd::serversignature: 'Off'

Configuration snippets can be added from anywhere in your manifest, based on files or templates, and will automatically reload httpd when changed :

apache_httpd::file { 'www.example.com.conf':
  source => 'puppet:///modules/mymodule/httpd.d/www.example.com.conf',
apache_httpd::file { 'global-alias.conf':
  content => 'Alias /whatever /var/www/whatever',
apache_httpd::file { 'myvhosts.conf':
  content => template('mymodule/httpd.d/myvhosts.conf.erb'),

Note that when adding or removing modules, a reload might not be sufficient, in which case you will have to perform a full restart by other means.


Before version 0.5 of the module, apache_httpd was a definition for historical reasons : It wasn't possible to pass parameters to classes when the module was initially written. Starting with 0.5.0, apache_httpd is now a class, making the module more flexible with Hiera or an ENC. Migrating to using the class is trivial :

apache_httpd { 'prefork':
  # Parameters here...

Becomes (since 'prefork' was the default) :

class { '::apache_httpd':
  # Same parameters here...

And the 'worker' title becomes the mpm => 'worker' parameter.