Forge Home

apache_httpd

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

39,843 downloads

33,457 latest version

3.1 quality score

We run a couple of automated
scans to help you access a
module's quality. Each module is
given a score based on how well
the author has formatted their
code and documentation and
modules are also checked for
malware using VirusTotal.

Please note, the information below
is for guidance only and neither of
these methods should be considered
an endorsement by Puppet.

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
  • ,

Start using this module

  • r10k or Code Manager
  • Bolt
  • Manual installation
  • Direct download

Add this module to your Puppetfile:

mod 'thias-apache_httpd', '1.0.0'
Learn more about managing modules with a Puppetfile

Add this module to your Bolt project:

bolt module add thias-apache_httpd
Learn more about using this module with an existing project

Manually install this module globally with Puppet module tool:

puppet module install thias-apache_httpd --version 1.0.0

Direct download is not typically how you would use a Puppet module to manage your infrastructure, but you may want to download the module in order to inspect the code.

Download
Tags: apache, web, httpd

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.