apache_httpd

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

Matthias Saou

thias

38,824 downloads

32,525 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
    ,
    CentOS

Start using this module

Tags: apache, httpd, web

Documentation

thias/apache_httpd — version 1.0.0 Apr 28th 2015

puppet apache_httpd

Overview

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

Examples

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 => [
    'auth_basic',
    'authn_file',
    'authz_host',
    'authz_user',
    'mime',
    'negotiation',
    'dir',
    'alias',
    'rewrite',
    'proxy',
  ],
  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.

Updating

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.