|
1 # apache |
|
2 |
|
3 [Module description]: #module-description |
|
4 |
|
5 [Setup]: #setup |
|
6 [Beginning with Apache]: #beginning-with-apache |
|
7 |
|
8 [Usage]: #usage |
|
9 [Configuring virtual hosts]: #configuring-virtual-hosts |
|
10 [Configuring virtual hosts with SSL]: #configuring-virtual-hosts-with-ssl |
|
11 [Configuring virtual host port and address bindings]: #configuring-virtual-host-port-and-address-bindings |
|
12 [Configuring virtual hosts for apps and processors]: #configuring-virtual-hosts-for-apps-and-processors |
|
13 [Configuring IP-based virtual hosts]: #configuring-ip-based-virtual-hosts |
|
14 [Installing Apache modules]: #installing-apache-modules |
|
15 [Installing arbitrary modules]: #installing-arbitrary-modules |
|
16 [Installing specific modules]: #installing-specific-modules |
|
17 [Configuring FastCGI servers]: #configuring-fastcgi-servers-to-handle-php-files |
|
18 [Load balancing examples]: #load-balancing-examples |
|
19 |
|
20 [Reference]: #reference |
|
21 [Public classes]: #public-classes |
|
22 [Private classes]: #private-classes |
|
23 [Public defines]: #public-defines |
|
24 [Private defines]: #private-defines |
|
25 [Templates]: #templates |
|
26 |
|
27 [Limitations]: #limitations |
|
28 |
|
29 [Development]: #development |
|
30 [Contributing]: #contributing |
|
31 [Running tests]: #running-tests |
|
32 |
|
33 [`AddDefaultCharset`]: http://httpd.apache.org/docs/current/mod/core.html#adddefaultcharset |
|
34 [`add_listen`]: #add_listen |
|
35 [`Alias`]: https://httpd.apache.org/docs/current/mod/mod_alias.html#alias |
|
36 [`AliasMatch`]: https://httpd.apache.org/docs/current/mod/mod_alias.html#aliasmatch |
|
37 [aliased servers]: https://httpd.apache.org/docs/current/urlmapping.html |
|
38 [`AllowEncodedSlashes`]: http://httpd.apache.org/docs/current/mod/core.html#allowencodedslashes |
|
39 [`apache`]: #class-apache |
|
40 [`apache_version`]: #apache_version |
|
41 [`apache::balancer`]: #define-apachebalancer |
|
42 [`apache::balancermember`]: #define-apachebalancermember |
|
43 [`apache::fastcgi::server`]: #define-apachefastcgiserver |
|
44 [`apache::mod`]: #define-apachemod |
|
45 [`apache::mod::<MODULE NAME>`]: #classes-apachemodmodule-name |
|
46 [`apache::mod::alias`]: #class-apachemodalias |
|
47 [`apache::mod::auth_cas`]: #class-apachemodauth_cas |
|
48 [`apache::mod::auth_mellon`]: #class-apachemodauth_mellon |
|
49 [`apache::mod::disk_cache`]: #class-apachemoddisk_cache |
|
50 [`apache::mod::event`]: #class-apachemodevent |
|
51 [`apache::mod::ext_filter`]: #class-apachemodext_filter |
|
52 [`apache::mod::geoip`]: #class-apachemodgeoip |
|
53 [`apache::mod::itk`]: #class-apachemoditk |
|
54 [`apache::mod::passenger`]: #class-apachemodpassenger |
|
55 [`apache::mod::peruser`]: #class-apachemodperuser |
|
56 [`apache::mod::prefork`]: #class-apachemodprefork |
|
57 [`apache::mod::proxy_html`]: #class-apachemodproxy_html |
|
58 [`apache::mod::security`]: #class-apachemodsecurity |
|
59 [`apache::mod::shib`]: #class-apachemodshib |
|
60 [`apache::mod::ssl`]: #class-apachemodssl |
|
61 [`apache::mod::status`]: #class-apachemodstatus |
|
62 [`apache::mod::worker`]: #class-apachemodworker |
|
63 [`apache::mod::wsgi`]: #class-apachemodwsgi |
|
64 [`apache::params`]: #class-apacheparams |
|
65 [`apache::version`]: #class-apacheversion |
|
66 [`apache::vhost`]: #define-apachevhost |
|
67 [`apache::vhost::WSGIImportScript`]: #wsgiimportscript |
|
68 [Apache HTTP Server]: http://httpd.apache.org |
|
69 [Apache modules]: http://httpd.apache.org/docs/current/mod/ |
|
70 [array]: https://docs.puppetlabs.com/puppet/latest/reference/lang_data_array.html |
|
71 |
|
72 [beaker-rspec]: https://github.com/puppetlabs/beaker-rspec |
|
73 |
|
74 [certificate revocation list]: http://httpd.apache.org/docs/current/mod/mod_ssl.html#sslcarevocationfile |
|
75 [certificate revocation list path]: http://httpd.apache.org/docs/current/mod/mod_ssl.html#sslcarevocationpath |
|
76 [common gateway interface]: http://httpd.apache.org/docs/current/howto/cgi.html |
|
77 [`confd_dir`]: #confd_dir |
|
78 [`content`]: #content |
|
79 [custom error documents]: http://httpd.apache.org/docs/current/custom-error.html |
|
80 [`custom_fragment`]: #custom_fragment |
|
81 |
|
82 [`default_mods`]: #default_mods |
|
83 [`default_ssl_crl`]: #default_ssl_crl |
|
84 [`default_ssl_crl_path`]: #default_ssl_crl_path |
|
85 [`default_ssl_vhost`]: #default_ssl_vhost |
|
86 [`dev_packages`]: #dev_packages |
|
87 [`directory`]: #directory |
|
88 [`directories`]: #parameter-directories-for-apachevhost |
|
89 [`DirectoryIndex`]: http://httpd.apache.org/docs/current/mod/mod_dir.html#directoryindex |
|
90 [`docroot`]: #docroot |
|
91 [`docroot_owner`]: #docroot_owner |
|
92 [`docroot_group`]: #docroot_group |
|
93 [`DocumentRoot`]: https://httpd.apache.org/docs/current/mod/core.html#documentroot |
|
94 |
|
95 [`EnableSendfile`]: http://httpd.apache.org/docs/current/mod/core.html#enablesendfile |
|
96 [`ExpiresByType`]: http://httpd.apache.org/docs/current/mod/mod_expires.html#expiresbytype |
|
97 [enforcing mode]: http://selinuxproject.org/page/Guide/Mode |
|
98 [`ensure`]: https://docs.puppetlabs.com/references/latest/type.html#package-attribute-ensure |
|
99 [exported resources]: http://docs.puppetlabs.com/latest/reference/lang_exported.md |
|
100 [`ExtendedStatus`]: http://httpd.apache.org/docs/current/mod/core.html#extendedstatus |
|
101 |
|
102 [Facter]: http://docs.puppetlabs.com/facter/ |
|
103 [FastCGI]: http://www.fastcgi.com/ |
|
104 [FallbackResource]: https://httpd.apache.org/docs/current/mod/mod_dir.html#fallbackresource |
|
105 [`fallbackresource`]: #fallbackresource |
|
106 [filter rules]: http://httpd.apache.org/docs/current/filter.html |
|
107 [`filters`]: #filters |
|
108 [`ForceType`]: http://httpd.apache.org/docs/current/mod/core.html#forcetype |
|
109 |
|
110 [GeoIPScanProxyHeaders]: http://dev.maxmind.com/geoip/legacy/mod_geoip2/#Proxy-Related_Directives |
|
111 [`gentoo/puppet-portage`]: https://github.com/gentoo/puppet-portage |
|
112 |
|
113 [Hash]: https://docs.puppetlabs.com/puppet/latest/reference/lang_data_hash.html |
|
114 |
|
115 [`IncludeOptional`]: http://httpd.apache.org/docs/current/mod/core.html#includeoptional |
|
116 [`Include`]: http://httpd.apache.org/docs/current/mod/core.html#include |
|
117 [interval syntax]: http://httpd.apache.org/docs/current/mod/mod_expires.html#AltSyn |
|
118 [`ip`]: #ip |
|
119 [`ip_based`]: #ip_based |
|
120 [IP-based virtual hosts]: http://httpd.apache.org/docs/current/vhosts/ip-based.html |
|
121 |
|
122 [`KeepAlive`]: http://httpd.apache.org/docs/current/mod/core.html#keepalive |
|
123 [`KeepAliveTimeout`]: http://httpd.apache.org/docs/current/mod/core.html#keepalivetimeout |
|
124 [`keepalive` parameter]: #keepalive |
|
125 [`keepalive_timeout`]: #keepalive_timeout |
|
126 |
|
127 [`lib`]: #lib |
|
128 [`lib_path`]: #lib_path |
|
129 [`Listen`]: http://httpd.apache.org/docs/current/bind.html |
|
130 [`ListenBackLog`]: https://httpd.apache.org/docs/current/mod/mpm_common.html#listenbacklog |
|
131 [`LoadFile`]: https://httpd.apache.org/docs/current/mod/mod_so.html#loadfile |
|
132 [`LogFormat`]: https://httpd.apache.org/docs/current/mod/mod_log_config.html#logformat |
|
133 [`logroot`]: #logroot |
|
134 [Log security]: http://httpd.apache.org/docs/current/logs.html#security |
|
135 |
|
136 [`manage_docroot`]: #manage_docroot |
|
137 [`manage_user`]: #manage_user |
|
138 [`manage_group`]: #manage_group |
|
139 [`MaxConnectionsPerChild`]: https://httpd.apache.org/docs/current/mod/mpm_common.html#maxconnectionsperchild |
|
140 [`max_keepalive_requests`]: #max_keepalive_requests |
|
141 [`MaxRequestWorkers`]: https://httpd.apache.org/docs/current/mod/mpm_common.html#maxrequestworkers |
|
142 [`MaxSpareThreads`]: https://httpd.apache.org/docs/current/mod/mpm_common.html#maxsparethreads |
|
143 [MIME `content-type`]: https://www.iana.org/assignments/media-types/media-types.xhtml |
|
144 [`MinSpareThreads`]: https://httpd.apache.org/docs/current/mod/mpm_common.html#minsparethreads |
|
145 [`mod_alias`]: https://httpd.apache.org/docs/current/mod/mod_alias.html |
|
146 [`mod_auth_cas`]: https://github.com/Jasig/mod_auth_cas |
|
147 [`mod_auth_kerb`]: http://modauthkerb.sourceforge.net/configure.html |
|
148 [`mod_authnz_external`]: https://code.google.com/p/mod-auth-external/ |
|
149 [`mod_auth_mellon`]: https://github.com/UNINETT/mod_auth_mellon |
|
150 [`mod_disk_cache`]: https://httpd.apache.org/docs/2.2/mod/mod_disk_cache.html |
|
151 [`mod_cache_disk`]: https://httpd.apache.org/docs/current/mod/mod_cache_disk.html |
|
152 [`mod_expires`]: http://httpd.apache.org/docs/current/mod/mod_expires.html |
|
153 [`mod_ext_filter`]: http://httpd.apache.org/docs/current/mod/mod_ext_filter.html |
|
154 [`mod_fcgid`]: https://httpd.apache.org/mod_fcgid/mod/mod_fcgid.html |
|
155 [`mod_geoip`]: http://dev.maxmind.com/geoip/legacy/mod_geoip2/ |
|
156 [`mod_info`]: https://httpd.apache.org/docs/current/mod/mod_info.html |
|
157 [`mod_mpm_event`]: https://httpd.apache.org/docs/current/mod/event.html |
|
158 [`mod_negotiation`]: http://httpd.apache.org/docs/current/mod/mod_negotiation.html |
|
159 [`mod_pagespeed`]: https://developers.google.com/speed/pagespeed/module/?hl=en |
|
160 [`mod_php`]: http://php.net/manual/en/book.apache.php |
|
161 [`mod_proxy`]: https://httpd.apache.org/docs/current/mod/mod_proxy.html |
|
162 [`mod_proxy_balancer`]: http://httpd.apache.org/docs/current/mod/mod_proxy_balancer.html |
|
163 [`mod_reqtimeout`]: http://httpd.apache.org/docs/current/mod/mod_reqtimeout.html |
|
164 [`mod_security`]: https://www.modsecurity.org/ |
|
165 [`mod_ssl`]: http://httpd.apache.org/docs/current/mod/mod_ssl.html |
|
166 [`mod_status`]: http://httpd.apache.org/docs/current/mod/mod_status.html |
|
167 [`mod_version`]: http://httpd.apache.org/docs/current/mod/mod_version.html |
|
168 [`mod_wsgi`]: http://modwsgi.readthedocs.org/en/latest/ |
|
169 [module contribution guide]: http://docs.puppetlabs.com/forge/contributing.html |
|
170 [`mpm_module`]: #mpm_module |
|
171 [multi-processing module]: http://httpd.apache.org/docs/current/mpm.html |
|
172 |
|
173 [name-based virtual hosts]: https://httpd.apache.org/docs/current/vhosts/name-based.html |
|
174 |
|
175 [open source Puppet]: http://docs.puppetlabs.com/puppet/ |
|
176 [`Options`]: https://httpd.apache.org/docs/current/mod/core.html#options |
|
177 |
|
178 [`path`]: #path |
|
179 [`Peruser`]: http://www.freebsd.org/cgi/url.cgi?ports/www/apache22-peruser-mpm/pkg-descr |
|
180 [`port`]: #port |
|
181 [`priority`]: #defines-apachevhost |
|
182 [`ProxyPass`]: http://httpd.apache.org/docs/current/mod/mod_proxy.html#proxypass |
|
183 [`ProxySet`]: http://httpd.apache.org/docs/current/mod/mod_proxy.html#proxyset |
|
184 [Puppet Enterprise]: http://docs.puppetlabs.com/pe/ |
|
185 [Puppet Forge]: http://forge.puppetlabs.com |
|
186 [Puppet Labs]: http://puppetlabs.com |
|
187 [Puppet module]: http://docs.puppetlabs.com/puppet/latest/reference/modules_fundamentals.html |
|
188 [Puppet module's code]: https://github.com/puppetlabs/puppetlabs-apache/blob/master/manifests/default_mods.pp |
|
189 [`purge_configs`]: #purge_configs |
|
190 [`purge_vhost_dir`]: #purge_vhost_dir |
|
191 [Python]: https://www.python.org/ |
|
192 |
|
193 [Rack]: http://rack.github.io/ |
|
194 [`rack_base_uris`]: #rack_base_uris |
|
195 [RFC 2616]: https://www.ietf.org/rfc/rfc2616.txt |
|
196 [`RequestReadTimeout`]: http://httpd.apache.org/docs/current/mod/mod_reqtimeout.html#requestreadtimeout |
|
197 [rspec-puppet]: http://rspec-puppet.com/ |
|
198 |
|
199 [`ScriptAlias`]: https://httpd.apache.org/docs/current/mod/mod_alias.html#scriptalias |
|
200 [`ScriptAliasMatch`]: https://httpd.apache.org/docs/current/mod/mod_alias.html#scriptaliasmatch |
|
201 [`scriptalias`]: #scriptalias |
|
202 [SELinux]: http://selinuxproject.org/ |
|
203 [`ServerAdmin`]: http://httpd.apache.org/docs/current/mod/core.html#serveradmin |
|
204 [`serveraliases`]: #serveraliases |
|
205 [`ServerLimit`]: https://httpd.apache.org/docs/current/mod/mpm_common.html#serverlimit |
|
206 [`ServerName`]: http://httpd.apache.org/docs/current/mod/core.html#servername |
|
207 [`ServerRoot`]: http://httpd.apache.org/docs/current/mod/core.html#serverroot |
|
208 [`ServerTokens`]: http://httpd.apache.org/docs/current/mod/core.html#servertokens |
|
209 [`ServerSignature`]: http://httpd.apache.org/docs/current/mod/core.html#serversignature |
|
210 [Service attribute restart]: http://docs.puppetlabs.com/references/latest/type.html#service-attribute-restart |
|
211 [`source`]: #source |
|
212 [`SSLCARevocationCheck`]: http://httpd.apache.org/docs/current/mod/mod_ssl.html#sslcarevocationcheck |
|
213 [SSL certificate key file]: http://httpd.apache.org/docs/current/mod/mod_ssl.html#sslcertificatekeyfile |
|
214 [SSL chain]: https://httpd.apache.org/docs/current/mod/mod_ssl.html#sslcertificatechainfile |
|
215 [SSL encryption]: https://httpd.apache.org/docs/current/ssl/index.html |
|
216 [`ssl`]: #ssl |
|
217 [`ssl_cert`]: #ssl_cert |
|
218 [`ssl_compression`]: #ssl_compression |
|
219 [`ssl_key`]: #ssl_key |
|
220 [`StartServers`]: https://httpd.apache.org/docs/current/mod/mpm_common.html#startservers |
|
221 [suPHP]: http://www.suphp.org/Home.html |
|
222 [`suphp_addhandler`]: #suphp_addhandler |
|
223 [`suphp_configpath`]: #suphp_configpath |
|
224 [`suphp_engine`]: #suphp_engine |
|
225 [supported operating system]: https://forge.puppetlabs.com/supported#puppet-supported-modules-compatibility-matrix |
|
226 |
|
227 [`ThreadLimit`]: http://httpd.apache.org/docs/current/mod/mpm_common.html#threadlimit |
|
228 [`ThreadsPerChild`]: https://httpd.apache.org/docs/current/mod/mpm_common.html#threadsperchild |
|
229 [`TimeOut`]: http://httpd.apache.org/docs/current/mod/core.html#timeout |
|
230 [template]: http://docs.puppetlabs.com/puppet/latest/reference/lang_template.html |
|
231 [`TraceEnable`]: http://httpd.apache.org/docs/current/mod/core.html#traceenable |
|
232 |
|
233 [`verify_config`]: #verify_config |
|
234 [`vhost`]: #define-apachevhost |
|
235 [`vhost_dir`]: #vhost_dir |
|
236 [`virtual_docroot`]: #virtual_docroot |
|
237 |
|
238 [Web Server Gateway Interface]: https://www.python.org/dev/peps/pep-3333/#abstract |
|
239 [`WSGIPythonPath`]: https://code.google.com/p/modwsgi/wiki/ConfigurationDirectives#WSGIPythonPath |
|
240 [`WSGIPythonHome`]: https://code.google.com/p/modwsgi/wiki/ConfigurationDirectives#WSGIPythonHome |
|
241 |
|
242 #### Table of Contents |
|
243 |
|
244 1. [Module description - What is the apache module, and what does it do?][Module description] |
|
245 2. [Setup - The basics of getting started with apache][Setup] |
|
246 - [Beginning with Apache - Installation][Beginning with Apache] |
|
247 3. [Usage - The classes and defined types available for configuration][Usage] |
|
248 - [Configuring virtual hosts - Examples to help get started][Configuring virtual hosts] |
|
249 - [Configuring FastCGI servers to handle PHP files][Configuring FastCGI servers] |
|
250 - [Load balancing with exported and non-exported resources][Load balancing examples] |
|
251 4. [Reference - An under-the-hood peek at what the module is doing and how][Reference] |
|
252 - [Public classes][] |
|
253 - [Private classes][] |
|
254 - [Public defines][] |
|
255 - [Private defines][] |
|
256 - [Templates][] |
|
257 5. [Limitations - OS compatibility, etc.][Limitations] |
|
258 6. [Development - Guide for contributing to the module][Development] |
|
259 - [Contributing to the apache module][Contributing] |
|
260 - [Running tests - A quick guide][Running tests] |
|
261 |
|
262 ## Module description |
|
263 |
|
264 [Apache HTTP Server][] (also called Apache HTTPD, or simply Apache) is a widely used web server. This [Puppet module][] simplifies the task of creating configurations to manage Apache servers in your infrastructure. It can configure and manage a range of virtual host setups and provides a streamlined way to install and configure [Apache modules][]. |
|
265 |
|
266 ## Setup |
|
267 |
|
268 **What the apache Puppet module affects:** |
|
269 |
|
270 - Configuration files and directories (created and written to) |
|
271 - **WARNING**: Configurations *not* managed by Puppet will be purged. |
|
272 - Package/service/configuration files for Apache |
|
273 - Apache modules |
|
274 - Virtual hosts |
|
275 - Listened-to ports |
|
276 - `/etc/make.conf` on FreeBSD and Gentoo |
|
277 |
|
278 On Gentoo, this module depends on the [`gentoo/puppet-portage`][] Puppet module. Note that while several options apply or enable certain features and settings for Gentoo, it is not a [supported operating system][] for this module. |
|
279 |
|
280 **Note**: This module modifies Apache configuration files and directories and purges any configuration not managed by Puppet. Apache configuration should be managed by Puppet, as unmanaged configuration files can cause unexpected failures. |
|
281 |
|
282 To temporarily disable full Puppet management, set the [`purge_configs`][] parameter in the [`apache`][] class declaration to 'false'. We recommend using this only as a temporary means of saving and relocating customized configurations. |
|
283 |
|
284 ### Beginning with Apache |
|
285 |
|
286 To have Puppet install Apache with the default parameters, declare the [`apache`][] class: |
|
287 |
|
288 ~~~ puppet |
|
289 class { 'apache': } |
|
290 ~~~ |
|
291 |
|
292 The Puppet module applies a default configuration based on your operating system; Debian, Red Hat, FreeBSD, and Gentoo systems each have unique default configurations. These defaults work in testing environments but are not suggested for production, and Puppet recommends customizing the class's parameters to suit your site. Use the [Reference](#reference) section to find information about the class's parameters and their default values. |
|
293 |
|
294 You can customize parameters when declaring the `apache` class. For instance, this declaration installs Apache without the apache module's [default virtual host configuration][Configuring virtual hosts], allowing you to customize all Apache virtual hosts: |
|
295 |
|
296 ~~~ puppet |
|
297 class { 'apache': |
|
298 default_vhost => false, |
|
299 } |
|
300 ~~~ |
|
301 |
|
302 ## Usage |
|
303 |
|
304 ### Configuring a virtual host |
|
305 |
|
306 The default [`apache`][] class sets up a virtual host on port 80, listening on all interfaces and serving the [`docroot`][] parameter's default directory of `/var/www`. |
|
307 |
|
308 **Note**: See the [`apache::vhost`][] define's reference for a list of all virtual host parameters. |
|
309 |
|
310 To configure basic [name-based virtual hosts][], specify the [`port`][] and [`docroot`][] parameters in the [`apache::vhost`][] define: |
|
311 |
|
312 ~~~ puppet |
|
313 apache::vhost { 'vhost.example.com': |
|
314 port => '80', |
|
315 docroot => '/var/www/vhost', |
|
316 } |
|
317 ~~~ |
|
318 |
|
319 **Note**: Apache processes virtual hosts in alphabetical order, and server administrators can prioritize Apache's virtual host processing by prefixing a virtual host's configuration file name with a number. The [`apache::vhost`][] define applies a default [`priority`][] of 15, which Puppet interprets by prefixing the virtual host's file name with `15-`. This all means that if multiple sites have the same priority, or if you disable priority numbers by setting the `priority` parameter's value to 'false', Apache still processes virtual hosts in alphabetical order. |
|
320 |
|
321 To configure user and group ownership for `docroot`, use the [`docroot_owner`][] and [`docroot_group`][] parameters: |
|
322 |
|
323 ~~~ puppet |
|
324 apache::vhost { 'user.example.com': |
|
325 port => '80', |
|
326 docroot => '/var/www/user', |
|
327 docroot_owner => 'www-data', |
|
328 docroot_group => 'www-data', |
|
329 } |
|
330 ~~~ |
|
331 |
|
332 #### Configuring virtual hosts with SSL |
|
333 |
|
334 To configure a virtual host to use [SSL encryption][] and default SSL certificates, set the [`ssl`][] parameter. You must also specify the [`port`][] parameter, typically with a value of '443', to accommodate HTTPS requests: |
|
335 |
|
336 ~~~ puppet |
|
337 apache::vhost { 'ssl.example.com': |
|
338 port => '443', |
|
339 docroot => '/var/www/ssl', |
|
340 ssl => true, |
|
341 } |
|
342 ~~~ |
|
343 |
|
344 To configure a virtual host to use SSL and specific SSL certificates, use the paths to the certificate and key in the [`ssl_cert`][] and [`ssl_key`][] parameters, respectively: |
|
345 |
|
346 ~~~ puppet |
|
347 apache::vhost { 'cert.example.com': |
|
348 port => '443', |
|
349 docroot => '/var/www/cert', |
|
350 ssl => true, |
|
351 ssl_cert => '/etc/ssl/fourth.example.com.cert', |
|
352 ssl_key => '/etc/ssl/fourth.example.com.key', |
|
353 } |
|
354 ~~~ |
|
355 |
|
356 To configure a mix of SSL and unencrypted virtual hosts at the same domain, declare them with separate [`apache::vhost`] defines: |
|
357 |
|
358 ~~~ puppet |
|
359 # The non-ssl virtual host |
|
360 apache::vhost { 'mix.example.com non-ssl': |
|
361 servername => 'mix.example.com', |
|
362 port => '80', |
|
363 docroot => '/var/www/mix', |
|
364 } |
|
365 |
|
366 # The SSL virtual host at the same domain |
|
367 apache::vhost { 'mix.example.com ssl': |
|
368 servername => 'mix.example.com', |
|
369 port => '443', |
|
370 docroot => '/var/www/mix', |
|
371 ssl => true, |
|
372 } |
|
373 ~~~ |
|
374 |
|
375 To configure a virtual host to redirect unencrypted connections to SSL, declare them with separate [`apache::vhost`] defines and redirect unencrypted requests to the virtual host with SSL enabled: |
|
376 |
|
377 ~~~ puppet |
|
378 apache::vhost { 'redirect.example.com non-ssl': |
|
379 servername => 'redirect.example.com', |
|
380 port => '80', |
|
381 docroot => '/var/www/redirect', |
|
382 redirect_status => 'permanent', |
|
383 redirect_dest => 'https://redirect.example.com/' |
|
384 } |
|
385 |
|
386 apache::vhost { 'redirect.example.com ssl': |
|
387 servername => 'redirect.example.com', |
|
388 port => '443', |
|
389 docroot => '/var/www/redirect', |
|
390 ssl => true, |
|
391 } |
|
392 ~~~ |
|
393 |
|
394 #### Configuring virtual host port and address bindings |
|
395 |
|
396 Virtual hosts listen on all IP addresses ('*') by default. To configure the virtual host to listen on a specific IP address, use the [`ip`][] parameter: |
|
397 |
|
398 ~~~ puppet |
|
399 apache::vhost { 'ip.example.com': |
|
400 ip => '127.0.0.1', |
|
401 port => '80', |
|
402 docroot => '/var/www/ip', |
|
403 } |
|
404 ~~~ |
|
405 |
|
406 It is also possible to configure more than one IP address per vhost by using an array of IP addresses for the [`ip`][] parameter: |
|
407 |
|
408 ~~~ puppet |
|
409 apache::vhost { 'ip.example.com': |
|
410 ip => ['127.0.0.1','169.254.1.1'], |
|
411 port => '80', |
|
412 docroot => '/var/www/ip', |
|
413 } |
|
414 ~~~ |
|
415 |
|
416 To configure a virtual host with [aliased servers][], refer to the aliases using the [`serveraliases`][] parameter: |
|
417 |
|
418 ~~~ puppet |
|
419 apache::vhost { 'aliases.example.com': |
|
420 serveraliases => [ |
|
421 'aliases.example.org', |
|
422 'aliases.example.net', |
|
423 ], |
|
424 port => '80', |
|
425 docroot => '/var/www/aliases', |
|
426 } |
|
427 ~~~ |
|
428 |
|
429 To set up a virtual host with a wildcard alias for the subdomain mapped to a same-named directory, such as 'http://example.com.loc' mapped to `/var/www/example.com`, define the wildcard alias using the [`serveraliases`][] parameter and the document root with the [`virtual_docroot`][] parameter: |
|
430 |
|
431 ~~~ puppet |
|
432 apache::vhost { 'subdomain.loc': |
|
433 vhost_name => '*', |
|
434 port => '80', |
|
435 virtual_docroot => '/var/www/%-2+', |
|
436 docroot => '/var/www', |
|
437 serveraliases => ['*.loc',], |
|
438 } |
|
439 ~~~ |
|
440 |
|
441 To configure a virtual host with [filter rules][], pass the filter directives as an [array][] using the [`filters`][] parameter: |
|
442 |
|
443 ~~~ puppet |
|
444 apache::vhost { 'subdomain.loc': |
|
445 port => '80', |
|
446 filters => [ |
|
447 'FilterDeclare COMPRESS', |
|
448 'FilterProvider COMPRESS DEFLATE resp=Content-Type $text/html', |
|
449 'FilterChain COMPRESS', |
|
450 'FilterProtocol COMPRESS DEFLATE change=yes;byteranges=no', |
|
451 ], |
|
452 docroot => '/var/www/html', |
|
453 } |
|
454 ~~~ |
|
455 |
|
456 #### Configuring virtual hosts for apps and processors |
|
457 |
|
458 To set up a virtual host with [suPHP][], use the [`suphp_engine`][] parameter to enable the suPHP engine, [`suphp_addhandler`][] parameter to define a MIME type, [`suphp_configpath`][] to set which path suPHP passes to the PHP interpreter, and the [`directory`][] parameter to configure Directory, File, and Location directive blocks: |
|
459 |
|
460 ~~~ puppet |
|
461 apache::vhost { 'suphp.example.com': |
|
462 port => '80', |
|
463 docroot => '/home/appuser/myphpapp', |
|
464 suphp_addhandler => 'x-httpd-php', |
|
465 suphp_engine => 'on', |
|
466 suphp_configpath => '/etc/php5/apache2', |
|
467 directories => [ |
|
468 { 'path' => '/home/appuser/myphpapp', |
|
469 'suphp' => { |
|
470 user => 'myappuser', |
|
471 group => 'myappgroup', |
|
472 }, |
|
473 }, |
|
474 ], |
|
475 } |
|
476 ~~~ |
|
477 |
|
478 You can use a set of parameters to configure a virtual host to use the [Web Server Gateway Interface][] (WSGI) for [Python][] applications: |
|
479 |
|
480 ~~~ puppet |
|
481 apache::vhost { 'wsgi.example.com': |
|
482 port => '80', |
|
483 docroot => '/var/www/pythonapp', |
|
484 wsgi_application_group => '%{GLOBAL}', |
|
485 wsgi_daemon_process => 'wsgi', |
|
486 wsgi_daemon_process_options => { |
|
487 processes => '2', |
|
488 threads => '15', |
|
489 display-name => '%{GROUP}', |
|
490 }, |
|
491 wsgi_import_script => '/var/www/demo.wsgi', |
|
492 wsgi_import_script_options => { |
|
493 process-group => 'wsgi', |
|
494 application-group => '%{GLOBAL}', |
|
495 }, |
|
496 wsgi_process_group => 'wsgi', |
|
497 wsgi_script_aliases => { '/' => '/var/www/demo.wsgi' }, |
|
498 } |
|
499 ~~~ |
|
500 |
|
501 Starting in Apache 2.2.16, Apache supports [FallbackResource][], a simple replacement for common RewriteRules. You can set a FallbackResource using the [`fallbackresource`][] parameter: |
|
502 |
|
503 ~~~ puppet |
|
504 apache::vhost { 'wordpress.example.com': |
|
505 port => '80', |
|
506 docroot => '/var/www/wordpress', |
|
507 fallbackresource => '/index.php', |
|
508 } |
|
509 ~~~ |
|
510 |
|
511 **Note**: The `fallbackresource` parameter only supports the 'disabled' value since Apache 2.2.24. |
|
512 |
|
513 To configure a virtual host with a designated directory for [Common Gateway Interface][] (CGI) files, use the [`scriptalias`][] parameter to define the `cgi-bin` path: |
|
514 |
|
515 ~~~ puppet |
|
516 apache::vhost { 'cgi.example.com': |
|
517 port => '80', |
|
518 docroot => '/var/www/cgi', |
|
519 scriptalias => '/usr/lib/cgi-bin', |
|
520 } |
|
521 ~~~ |
|
522 |
|
523 To configure a virtual host for [Rack][], use the [`rack_base_uris`][] parameter: |
|
524 |
|
525 ~~~ puppet |
|
526 apache::vhost { 'rack.example.com': |
|
527 port => '80', |
|
528 docroot => '/var/www/rack', |
|
529 rack_base_uris => ['/rackapp1', '/rackapp2'], |
|
530 } |
|
531 ~~~ |
|
532 |
|
533 #### Configuring IP-based virtual hosts |
|
534 |
|
535 You can configure [IP-based virtual hosts][] to listen on any port and have them respond to requests on specific IP addresses. In this example, we set the server to listen on ports 80 and 81 because the example virtual hosts are _not_ declared with a [`port`][] parameter: |
|
536 |
|
537 ~~~ puppet |
|
538 apache::listen { '80': } |
|
539 |
|
540 apache::listen { '81': } |
|
541 ~~~ |
|
542 |
|
543 Then we configure the IP-based virtual hosts with the [`ip_based`][] parameter: |
|
544 |
|
545 ~~~ puppet |
|
546 apache::vhost { 'first.example.com': |
|
547 ip => '10.0.0.10', |
|
548 docroot => '/var/www/first', |
|
549 ip_based => true, |
|
550 } |
|
551 |
|
552 apache::vhost { 'second.example.com': |
|
553 ip => '10.0.0.11', |
|
554 docroot => '/var/www/second', |
|
555 ip_based => true, |
|
556 } |
|
557 ~~~ |
|
558 |
|
559 You can also configure a mix of IP- and [name-based virtual hosts][], and in any combination of [SSL][SSL encryption] and unencrypted configurations. First, we add two IP-based virtual hosts on an IP address (in this example, 10.0.0.10). One uses SSL and the other is unencrypted: |
|
560 |
|
561 ~~~ puppet |
|
562 apache::vhost { 'The first IP-based virtual host, non-ssl': |
|
563 servername => 'first.example.com', |
|
564 ip => '10.0.0.10', |
|
565 port => '80', |
|
566 ip_based => true, |
|
567 docroot => '/var/www/first', |
|
568 } |
|
569 |
|
570 apache::vhost { 'The first IP-based vhost, ssl': |
|
571 servername => 'first.example.com', |
|
572 ip => '10.0.0.10', |
|
573 port => '443', |
|
574 ip_based => true, |
|
575 docroot => '/var/www/first-ssl', |
|
576 ssl => true, |
|
577 } |
|
578 ~~~ |
|
579 |
|
580 Next, we add two name-based virtual hosts listening on a second IP address (10.0.0.20): |
|
581 |
|
582 ~~~ puppet |
|
583 apache::vhost { 'second.example.com': |
|
584 ip => '10.0.0.20', |
|
585 port => '80', |
|
586 docroot => '/var/www/second', |
|
587 } |
|
588 |
|
589 apache::vhost { 'third.example.com': |
|
590 ip => '10.0.0.20', |
|
591 port => '80', |
|
592 docroot => '/var/www/third', |
|
593 } |
|
594 ~~~ |
|
595 |
|
596 To add name-based virtual hosts that answer on either 10.0.0.10 or 10.0.0.20, you **must** set the [`add_listen`][] parameter to 'false' to disable the default Apache setting of `Listen 80`, as it conflicts with the preceding IP-based virtual hosts. |
|
597 |
|
598 ~~~ puppet |
|
599 apache::vhost { 'fourth.example.com': |
|
600 port => '80', |
|
601 docroot => '/var/www/fourth', |
|
602 add_listen => false, |
|
603 } |
|
604 |
|
605 apache::vhost { 'fifth.example.com': |
|
606 port => '80', |
|
607 docroot => '/var/www/fifth', |
|
608 add_listen => false, |
|
609 } |
|
610 ~~~ |
|
611 |
|
612 ### Installing Apache modules |
|
613 |
|
614 There's two ways to install [Apache modules][] using the Puppet apache module: |
|
615 |
|
616 - Use the [`apache::mod::<MODULE NAME>`][] classes to [install specific Apache modules with parameters][Installing specific modules]. |
|
617 - Use the [`apache::mod`][] define to [install arbitrary Apache modules][Installing arbitrary modules]. |
|
618 |
|
619 #### Installing specific modules |
|
620 |
|
621 The Puppet apache module supports installing many common [Apache modules][], often with parameterized configuration options. For a list of supported Apache modules, see the [`apache::mod::<MODULE NAME>`][] class references. |
|
622 |
|
623 For example, you can install the `mod_ssl` Apache module with default settings by declaring the [`apache::mod::ssl`][] class: |
|
624 |
|
625 ~~~ puppet |
|
626 class { 'apache::mod::ssl': } |
|
627 ~~~ |
|
628 |
|
629 [`apache::mod::ssl`][] has several parameterized options that you can set when declaring it. For instance, to enable `mod_ssl` with compression enabled, set the [`ssl_compression`][] parameter to 'true': |
|
630 |
|
631 ~~~ puppet |
|
632 class { 'apache::mod::ssl': |
|
633 ssl_compression => true, |
|
634 } |
|
635 ~~~ |
|
636 |
|
637 Note that some modules have prerequisites, which are documented in their references under [`apache::mod::<MODULE NAME>`][]. |
|
638 |
|
639 #### Installing arbitrary modules |
|
640 |
|
641 You can pass the name of any module that your operating system's package manager can install to the [`apache::mod`][] define to install it. Unlike the specific-module classes, the [`apache::mod`][] define doesn't tailor the installation based on other installed modules or with specific parameters---Puppet only grabs and installs the module's package, leaving detailed configuration up to you. |
|
642 |
|
643 For example, to install the [`mod_authnz_external`][] Apache module, declare the define with the 'mod_authnz_external' name: |
|
644 |
|
645 ~~~ puppet |
|
646 apache::mod { 'mod_authnz_external': } |
|
647 ~~~ |
|
648 |
|
649 There's several optional parameters you can specify when defining Apache modules this way. See the [define's reference][`apache::mod`] for details. |
|
650 |
|
651 ### Configuring FastCGI servers to handle PHP files |
|
652 |
|
653 Add the [`apache::fastcgi::server`][] define to allow [FastCGI][] servers to handle requests for specific files. For example, the following defines a FastCGI server at 127.0.0.1 (localhost) on port 9000 to handle PHP requests: |
|
654 |
|
655 ~~~ puppet |
|
656 apache::fastcgi::server { 'php': |
|
657 host => '127.0.0.1:9000', |
|
658 timeout => 15, |
|
659 flush => false, |
|
660 faux_path => '/var/www/php.fcgi', |
|
661 fcgi_alias => '/php.fcgi', |
|
662 file_type => 'application/x-httpd-php' |
|
663 } |
|
664 ~~~ |
|
665 |
|
666 You can then use the [`custom_fragment`] parameter to configure the virtual host to have the FastCGI server handle the specified file type: |
|
667 |
|
668 ~~~ puppet |
|
669 apache::vhost { 'www': |
|
670 ... |
|
671 custom_fragment => 'AddType application/x-httpd-php .php' |
|
672 ... |
|
673 } |
|
674 ~~~ |
|
675 |
|
676 ### Load balancing examples |
|
677 |
|
678 Apache supports load balancing across groups of servers through the [`mod_proxy`][] Apache module. Puppet supports configuring Apache load balancing groups (also known as balancer clusters) through the [`apache::balancer`][] and [`apache::balancermember`][] defines. |
|
679 |
|
680 To enable load balancing with [exported resources][], export the [`apache::balancermember`][] define from the load balancer member server: |
|
681 |
|
682 ~~~ puppet |
|
683 @@apache::balancermember { "${::fqdn}-puppet00": |
|
684 balancer_cluster => 'puppet00', |
|
685 url => "ajp://${::fqdn}:8009", |
|
686 options => ['ping=5', 'disablereuse=on', 'retry=5', 'ttl=120'], |
|
687 } |
|
688 ~~~ |
|
689 |
|
690 Then, on the proxy server, create the load balancing group: |
|
691 |
|
692 ~~~ puppet |
|
693 apache::balancer { 'puppet00': } |
|
694 ~~~ |
|
695 |
|
696 To enable load balancing without exporting resources, declare the following on the proxy server: |
|
697 |
|
698 ~~~ puppet |
|
699 apache::balancer { 'puppet00': } |
|
700 |
|
701 apache::balancermember { "${::fqdn}-puppet00": |
|
702 balancer_cluster => 'puppet00', |
|
703 url => "ajp://${::fqdn}:8009", |
|
704 options => ['ping=5', 'disablereuse=on', 'retry=5', 'ttl=120'], |
|
705 } |
|
706 ~~~ |
|
707 |
|
708 Then declare the `apache::balancer` and `apache::balancermember` defines on the proxy server. |
|
709 |
|
710 If you need to use the [ProxySet](http://httpd.apache.org/docs/current/mod/mod_proxy.html#proxyset) directive on the balancer, use the [`proxy_set`](#proxy_set) parameter of `apache::balancer`: |
|
711 |
|
712 ~~~ puppet |
|
713 apache::balancer { 'puppet01': |
|
714 proxy_set => { |
|
715 'stickysession' => 'JSESSIONID', |
|
716 }, |
|
717 } |
|
718 ~~~ |
|
719 |
|
720 ## Reference |
|
721 |
|
722 - [**Public Classes**](#public-classes) |
|
723 - [Class: apache](#class-apache) |
|
724 - [Class: apache::dev](#class-apachedev) |
|
725 - [Classes: apache::mod::*](#classes-apachemodname) |
|
726 - [**Private Classes**](#private-classes) |
|
727 - [Class: apache::confd::no_accf](#class-apacheconfdno_accf) |
|
728 - [Class: apache::default_confd_files](#class-apachedefault_confd_files) |
|
729 - [Class: apache::default_mods](#class-apachedefault_mods) |
|
730 - [Class: apache::package](#class-apachepackage) |
|
731 - [Class: apache::params](#class-apacheparams) |
|
732 - [Class: apache::service](#class-apacheservice) |
|
733 - [Class: apache::version](#class-apacheversion) |
|
734 - [**Public Defines**](#public-defines) |
|
735 - [Define: apache::balancer](#define-apachebalancer) |
|
736 - [Define: apache::balancermember](#define-apachebalancermember) |
|
737 - [Define: apache::custom_config](#define-apachecustom_config) |
|
738 - [Define: apache::fastcgi::server](#define-fastcgi-server) |
|
739 - [Define: apache::listen](#define-apachelisten) |
|
740 - [Define: apache::mod](#define-apachemod) |
|
741 - [Define: apache::namevirtualhost](#define-apachenamevirtualhost) |
|
742 - [Define: apache::vhost](#define-apachevhost) |
|
743 - [**Private Defines**](#private-defines) |
|
744 - [Define: apache::default_mods::load](#define-default_mods-load) |
|
745 - [Define: apache::peruser::multiplexer](#define-apacheperusermultiplexer) |
|
746 - [Define: apache::peruser::processor](#define-apacheperuserprocessor) |
|
747 - [Define: apache::security::file_link](#define-apachesecurityfile_link) |
|
748 - [**Templates**](#templates) |
|
749 |
|
750 ### Public Classes |
|
751 |
|
752 #### Class: `apache` |
|
753 |
|
754 Guides the basic setup and installation of Apache on your system. |
|
755 |
|
756 When this class is declared with the default options, Puppet: |
|
757 |
|
758 - Installs the appropriate Apache software package and [required Apache modules](#default_mods) for your operating system. |
|
759 - Places the required configuration files in a directory, with the [default location](#conf_dir) determined by your operating system. |
|
760 - Configures the server with a default virtual host and standard port ('80') and address ('*') bindings. |
|
761 - Creates a document root directory determined by your operating system, typically `/var/www`. |
|
762 - Starts the Apache service. |
|
763 |
|
764 You can simply declare the default `apache` class: |
|
765 |
|
766 ~~~ puppet |
|
767 class { 'apache': } |
|
768 ~~~ |
|
769 |
|
770 You can establish a default virtual host in this class, by using the [`apache::vhost`][] define, or both. You can also configure additional specific virtual hosts with the [`apache::vhost`][] define. Puppet recommends customizing the `apache` class's declaration with the following parameters, as its default settings are not optimized for production. |
|
771 |
|
772 **Parameters within `apache`:** |
|
773 |
|
774 ##### `allow_encoded_slashes` |
|
775 |
|
776 Sets the server default for the [`AllowEncodedSlashes`][] declaration, which modifies the responses to URLs containing '\' and '/' characters. Valid options: 'on', 'off', 'nodecode'. Default: 'undef', which omits the declaration from the server's configuration and uses Apache's default setting of 'off'. |
|
777 |
|
778 ##### `apache_version` |
|
779 |
|
780 Configures module template behavior, package names, and default Apache modules by defining the version of Apache to use. Default: Determined by your operating system family and release via the [`apache::version`][] class. Puppet recommends against manually configuring this parameter without reason. |
|
781 |
|
782 ##### `conf_dir` |
|
783 |
|
784 Sets the directory where the Apache server's main configuration file is located. Default: Depends on your operating system. |
|
785 |
|
786 - **Debian**: `/etc/apache2` |
|
787 - **FreeBSD**: `/usr/local/etc/apache22` |
|
788 - **Gentoo**: `/etc/apache2` |
|
789 - **Red Hat**: `/etc/httpd/conf` |
|
790 |
|
791 ##### `conf_template` |
|
792 |
|
793 Defines the [template][] used for the main Apache configuration file. Default: `apache/httpd.conf.erb`. Modifying this parameter is potentially risky, as the apache Puppet module is designed to use a minimal configuration file customized by `conf.d` entries. |
|
794 |
|
795 ##### `confd_dir` |
|
796 |
|
797 Sets the location of the Apache server's custom configuration directory. Default: Depends on your operating system. |
|
798 |
|
799 - **Debian**: `/etc/apache2/conf.d` |
|
800 - **FreeBSD**: `/usr/local/etc/apache22` |
|
801 - **Gentoo**: `/etc/apache2/conf.d` |
|
802 - **Red Hat**: `/etc/httpd/conf.d` |
|
803 |
|
804 ##### `default_charset` |
|
805 |
|
806 Used as the [`AddDefaultCharset`][] directive in the main configuration file. Default: 'undef'. |
|
807 |
|
808 ##### `default_confd_files` |
|
809 |
|
810 Determines whether Puppet generates a default set of includable Apache configuration files in the directory defined by the [`confd_dir`][] parameter. These configuration files correspond to what is typically installed with the Apache package on the server's operating system. Valid options: Boolean. Default: 'true'. |
|
811 |
|
812 ##### `default_mods` |
|
813 |
|
814 Determines whether to configure and enable a set of default [Apache modules][] depending on your operating system. Valid options: 'true', 'false', or an array of Apache module names. Default: 'true'. |
|
815 |
|
816 If this parameter's value is 'false', Puppet only includes the Apache modules required to make the HTTP daemon work on your operating system, and you can declare any other modules separately using the [`apache::mod::<MODULE NAME>`][] class or [`apache::mod`][] define. |
|
817 |
|
818 If 'true', Puppet installs additional modules, the list of which depends on the operating system as well as the [`apache_version`][] and [`mpm_module`][] parameters' values. As these lists of modules can change frequently, consult the [Puppet module's code][] for up-to-date lists. |
|
819 |
|
820 If this parameter contains an array, Puppet instead enables all passed Apache modules. |
|
821 |
|
822 ##### `default_ssl_ca` |
|
823 |
|
824 Sets the default certificate authority for the Apache server. Default: 'undef'. |
|
825 |
|
826 While this default value results in a functioning Apache server, you **must** update this parameter with your certificate authority information before deploying this server in a production environment. |
|
827 |
|
828 ##### `default_ssl_cert` |
|
829 |
|
830 Sets the [SSL encryption][] certificate location. Default: Determined by your operating system. |
|
831 |
|
832 - **Debian**: `/etc/ssl/certs/ssl-cert-snakeoil.pem` |
|
833 - **FreeBSD**: `/usr/local/etc/apache22/server.crt` |
|
834 - **Gentoo**: `/etc/ssl/apache2/server.crt` |
|
835 - **Red Hat**: `/etc/pki/tls/certs/localhost.crt` |
|
836 |
|
837 While the default value results in a functioning Apache server, you **must** update this parameter with your certificate location before deploying this server in a production environment. |
|
838 |
|
839 ##### `default_ssl_chain` |
|
840 |
|
841 Sets the default [SSL chain][] location. Default: 'undef'. |
|
842 |
|
843 While this default value results in a functioning Apache server, you **must** update this parameter with your SSL chain before deploying this server in a production environment. |
|
844 |
|
845 ##### `default_ssl_crl` |
|
846 |
|
847 Sets the path of the default [certificate revocation list][] (CRL) file to use. Default: 'undef'. |
|
848 |
|
849 While this default value results in a functioning Apache server, you **must** update this parameter with your CRL file's path before deploying this server in a production environment. You can use this parameter with or in place of the [`default_ssl_crl_path`][]. |
|
850 |
|
851 ##### `default_ssl_crl_path` |
|
852 |
|
853 Sets the server's [certificate revocation list path][], which contains your CRLs. Default: 'undef'. |
|
854 |
|
855 While this default value results in a functioning Apache server, you **must** update this parameter with the CRL path before deploying this server in a production environment. |
|
856 |
|
857 ##### `default_ssl_crl_check` |
|
858 |
|
859 Sets the default certificate revocation check level via the [`SSLCARevocationCheck`][] directive. Default: 'undef'. |
|
860 |
|
861 While this default value results in a functioning Apache server, you **must** specify this parameter when using certificate revocation lists in a production environment. |
|
862 |
|
863 This parameter only applies to Apache 2.4 or higher and is ignored on older versions. |
|
864 |
|
865 ##### `default_ssl_key` |
|
866 |
|
867 Sets the [SSL certificate key file][] location. Default: Determined by your operating system. |
|
868 |
|
869 - **Debian**: `/etc/ssl/private/ssl-cert-snakeoil.key` |
|
870 - **FreeBSD**: `/usr/local/etc/apache22/server.key` |
|
871 - **Gentoo**: `/etc/ssl/apache2/server.key` |
|
872 - **Red Hat**: `/etc/pki/tls/private/localhost.key` |
|
873 |
|
874 While these default values result in a functioning Apache server, you **must** update this parameter with your SSL key's location before deploying this server in a production environment. |
|
875 |
|
876 ##### `default_ssl_vhost` |
|
877 |
|
878 Configures a default [SSL][SSL encryption] virtual host. Valid options: Boolean. Default: 'false'. |
|
879 |
|
880 If 'true', Puppet automatically configures the following virtual host using the [`apache::vhost`][] define: |
|
881 |
|
882 ~~~ puppet |
|
883 apache::vhost { 'default-ssl': |
|
884 port => 443, |
|
885 ssl => true, |
|
886 docroot => $docroot, |
|
887 scriptalias => $scriptalias, |
|
888 serveradmin => $serveradmin, |
|
889 access_log_file => "ssl_${access_log_file}", |
|
890 } |
|
891 ~~~ |
|
892 |
|
893 **Note**: SSL virtual hosts only respond to HTTPS queries. |
|
894 |
|
895 ##### `default_type` |
|
896 |
|
897 _Apache 2.2 only_. Sets the [MIME `content-type`][] sent if the server cannot otherwise determine an appropriate `content-type`. This directive is deprecated in Apache 2.4 and newer and only exists for backwards compatibility in configuration files. Default: 'undef'. |
|
898 |
|
899 ##### `default_vhost` |
|
900 |
|
901 Configures a default virtual host when the class is declared. Valid options: Boolean. Default: 'true'. |
|
902 |
|
903 To configure [customized virtual hosts][Configuring virtual hosts], set this parameter's value to 'false'. |
|
904 |
|
905 ##### `dev_packages` |
|
906 |
|
907 Configures a specific dev package to use. Valid options: String. Default: 'OS default httpd dev package'. |
|
908 |
|
909 Example for using httpd 2.4 from the IUS yum repo: |
|
910 |
|
911 ~~~ puppet |
|
912 include ::apache::dev |
|
913 class { 'apache': |
|
914 apache_name => 'httpd24u', |
|
915 dev_packages => 'httpd24u-devel', |
|
916 } |
|
917 ~~~ |
|
918 |
|
919 ##### `docroot` |
|
920 |
|
921 Sets the default [`DocumentRoot`][] location. Default: Determined by your operating system. |
|
922 |
|
923 - **Debian**: `/var/www/html` |
|
924 - **FreeBSD**: `/usr/local/www/apache22/data` |
|
925 - **Gentoo**: `/var/www/localhost/htdocs` |
|
926 - **Red Hat**: `/var/www/html` |
|
927 |
|
928 ##### `error_documents` |
|
929 |
|
930 Determines whether to enable [custom error documents][] on the Apache server. Valid options: Boolean. Default: 'false'. |
|
931 |
|
932 ##### `group` |
|
933 |
|
934 Sets the group ID that owns any Apache processes spawned to answer requests. |
|
935 |
|
936 By default, Puppet attempts to manage this group as a resource under the `apache` class, determining the group based on the operating system as detected by the [`apache::params`][] class. To to prevent the group resource from being created and use a group created by another Puppet module, set the [`manage_group`][] parameter's value to 'false'. |
|
937 |
|
938 **Note**: Modifying this parameter only changes the group ID that Apache uses to spawn child processes to access resources. It does not change the user that owns the parent server process. |
|
939 |
|
940 ##### `httpd_dir` |
|
941 |
|
942 Sets the Apache server's base configuration directory. This is useful for specially repackaged Apache server builds but might have unintended consequences when combined with the default distribution packages. Default: Determined by your operating system. |
|
943 |
|
944 - **Debian**: `/etc/apache2` |
|
945 - **FreeBSD**: `/usr/local/etc/apache22` |
|
946 - **Gentoo**: `/etc/apache2` |
|
947 - **Red Hat**: `/etc/httpd` |
|
948 |
|
949 ##### `keepalive` |
|
950 |
|
951 Determines whether to enable persistent HTTP connections with the [`KeepAlive`][] directive. Valid options: 'Off', 'On'. Default: 'Off'. |
|
952 |
|
953 If 'On', use the [`keepalive_timeout`][] and [`max_keepalive_requests`][] parameters to set relevant options. |
|
954 |
|
955 ##### `keepalive_timeout` |
|
956 |
|
957 Sets the [`KeepAliveTimeout`] directive, which determines the amount of time the Apache server waits for subsequent requests on a persistent HTTP connection. Default: '15'. |
|
958 |
|
959 This parameter is only relevant if the [`keepalive` parameter][] is enabled. |
|
960 |
|
961 ##### `max_keepalive_requests` |
|
962 |
|
963 Limits the number of requests allowed per connection when the [`keepalive` parameter][] is enabled. Default: '100'. |
|
964 |
|
965 ##### `lib_path` |
|
966 |
|
967 Specifies the location where [Apache module][Apache modules] files are stored. Default: Depends on the operating system. |
|
968 |
|
969 - **Debian** and **Gentoo**: `/usr/lib/apache2/modules` |
|
970 - **FreeBSD**: `/usr/local/libexec/apache24` |
|
971 - **Red Hat**: `modules` |
|
972 |
|
973 **Note**: Do not configure this parameter manually without special reason. |
|
974 |
|
975 ##### `loadfile_name` |
|
976 |
|
977 Sets the [`LoadFile`] directive's filename. Valid options: Filenames in the format `\*.load`. |
|
978 |
|
979 This can be used to set the module load order. |
|
980 |
|
981 ##### `log_level` |
|
982 |
|
983 Changes the error log's verbosity. Valid options: 'alert', 'crit', 'debug', 'emerg', 'error', 'info', 'notice', 'warn'. Default: 'warn'. |
|
984 |
|
985 ##### `log_formats` |
|
986 |
|
987 Define additional [`LogFormat`][] directives. Valid options: A [Hash][], such as: |
|
988 |
|
989 ~~~ puppet |
|
990 $log_formats = { vhost_common => '%v %h %l %u %t \"%r\" %>s %b' } |
|
991 ~~~ |
|
992 |
|
993 There are a number of predefined `LogFormats` in the `httpd.conf` that Puppet creates: |
|
994 |
|
995 ~~~ httpd |
|
996 LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined |
|
997 LogFormat "%h %l %u %t \"%r\" %>s %b" common |
|
998 LogFormat "%{Referer}i -> %U" referer |
|
999 LogFormat "%{User-agent}i" agent |
|
1000 ~~~ |
|
1001 |
|
1002 If your `log_formats` parameter contains one of those, it will be overwritten with **your** definition. |
|
1003 |
|
1004 ##### `logroot` |
|
1005 |
|
1006 Changes the directory of Apache log files for the virtual host. Default: Determined by your operating system. |
|
1007 |
|
1008 - **Debian**: `/var/log/apache2` |
|
1009 - **FreeBSD**: `/var/log/apache22` |
|
1010 - **Gentoo**: `/var/log/apache2` |
|
1011 - **Red Hat**: `/var/log/httpd` |
|
1012 |
|
1013 ##### `logroot_mode` |
|
1014 |
|
1015 Overrides the default [`logroot`][] directory's mode. Default: 'undef'. |
|
1016 |
|
1017 **Note**: Do _not_ grant write access to the directory where the logs are stored without being aware of the consequences. See the [Apache documentation][Log security] for details. |
|
1018 |
|
1019 ##### `manage_group` |
|
1020 |
|
1021 When 'false', stops Puppet from creating the group resource. Valid options: Boolean. Default: 'true'. |
|
1022 |
|
1023 If you have a group created from another Puppet module that you want to use to run Apache, set this to 'false'. Without this parameter, attempting to use a previously established group results in a duplicate resource error. |
|
1024 |
|
1025 ##### `manage_user` |
|
1026 |
|
1027 When 'false', stops Puppet from creating the user resource. Valid options: Boolean. Default: 'true'. |
|
1028 |
|
1029 This is for instances when you have a user, created from another Puppet module, you want to use to run Apache. Without this parameter, attempting to use a previously established user would result in a duplicate resource error. |
|
1030 |
|
1031 ##### `mod_dir` |
|
1032 |
|
1033 Sets where Puppet places configuration files for your [Apache modules][]. Default: Determined by your operating system. |
|
1034 |
|
1035 - **Debian**: `/etc/apache2/mods-available` |
|
1036 - **FreeBSD**: `/usr/local/etc/apache22/Modules` |
|
1037 - **Gentoo**: `/etc/apache2/modules.d` |
|
1038 - **Red Hat**: `/etc/httpd/conf.d` |
|
1039 |
|
1040 ##### `mpm_module` |
|
1041 |
|
1042 Determines which [multi-processing module][] (MPM) is loaded and configured for the HTTPD process. Valid options: 'event', 'itk', 'peruser', 'prefork', 'worker', or 'false'. Default: Determined by your operating system. |
|
1043 |
|
1044 - **Debian**: `worker` |
|
1045 - **FreeBSD, Gentoo, and Red Hat**: `prefork` |
|
1046 |
|
1047 You must set this to 'false' to explicitly declare the following classes with custom parameters: |
|
1048 |
|
1049 - [`apache::mod::event`][] |
|
1050 - [`apache::mod::itk`][] |
|
1051 - [`apache::mod::peruser`][] |
|
1052 - [`apache::mod::prefork`][] |
|
1053 - [`apache::mod::worker`][] |
|
1054 |
|
1055 **Note**: Switching between different MPMs on FreeBSD is possible but quite difficult. Before changing `mpm_module`, you must uninstall all packages that depend on your installed Apache server. |
|
1056 |
|
1057 ##### `package_ensure` |
|
1058 |
|
1059 Controls the `package` resource's [`ensure`][] attribute. Valid options: 'absent', 'installed' (or the equivalent 'present'), or a version string. Default: 'installed'. |
|
1060 |
|
1061 ##### `pidfile` |
|
1062 |
|
1063 Allows settting a custom location for the pid file - useful if using a custom built Apache rpm. Defaults to 'run/httpd.pid' on RedHat, '/var/run/httpd.pid on FreeBSD and '\${APACHE_PID_FILE}' on Debian. |
|
1064 |
|
1065 ##### `ports_file` |
|
1066 |
|
1067 Sets the path to the file containing Apache ports configuration. Default: `{$conf_dir}/ports.conf`. |
|
1068 |
|
1069 ##### `purge_configs` |
|
1070 |
|
1071 Removes all other Apache configs and virtual hosts. Valid options: Boolean. Default: 'true'. |
|
1072 |
|
1073 Setting this to 'false' is a stopgap measure to allow the apache Puppet module to coexist with existing or unmanaged configurations. We recommend moving your configuration to resources within this module. For virtual host configurations, see [`purge_vhost_dir`][]. |
|
1074 |
|
1075 ##### `purge_vhost_dir` |
|
1076 |
|
1077 If the [`vhost_dir`][] parameter's value differs from the [`confd_dir`][] parameter's, the Boolean parameter `purge_vhost_dir` determines whether Puppet removes any configurations inside `vhost_dir` _not_ managed by Puppet. Default: same as [`purge_configs`][]. |
|
1078 |
|
1079 Setting `purge_vhost_dir` to 'false' is a stopgap measure to allow the apache Puppet module to coexist with existing or otherwise unmanaged configurations within `vhost_dir`. |
|
1080 |
|
1081 ##### `rewrite_lock` |
|
1082 |
|
1083 Allows setting a custom location for a rewrite lock - considered best practice if using a RewriteMap of type prg in the [`rewrites`][] parameter of your vhost. Default: 'undef'. |
|
1084 |
|
1085 This parameter only applies to Apache version 2.2 or lower and is ignored on newer versions. |
|
1086 |
|
1087 ##### `sendfile` |
|
1088 |
|
1089 Forces Apache to use the Linux kernel's `sendfile` support to serve static files, via the [`EnableSendfile`][] directive. Valid options: 'On', 'Off'. Default: 'On'. |
|
1090 |
|
1091 ##### `serveradmin` |
|
1092 |
|
1093 Sets the Apache server administrator's contact information via Apache's [`ServerAdmin`][] directive. Default: 'root@localhost'. |
|
1094 |
|
1095 ##### `servername` |
|
1096 |
|
1097 Sets the Apache server name via Apache's [`ServerName`][] directive. Default: the 'fqdn' fact reported by [Facter][]. |
|
1098 |
|
1099 ##### `server_root` |
|
1100 |
|
1101 Sets the Apache server's root directory via Apache's [`ServerRoot`][] directive. Default: determined by your operating system. |
|
1102 |
|
1103 - **Debian**: `/etc/apache2` |
|
1104 - **FreeBSD**: `/usr/local` |
|
1105 - **Gentoo**: `/var/www` |
|
1106 - **Red Hat**: `/etc/httpd` |
|
1107 |
|
1108 ##### `server_signature` |
|
1109 |
|
1110 Configures a trailing footer line to display at the bottom of server-generated documents, such as error documents and output of certain [Apache modules][], via Apache's [`ServerSignature`][] directive. Valid options: 'Off', 'On'. Default: 'On'. |
|
1111 |
|
1112 ##### `server_tokens` |
|
1113 |
|
1114 Controls how much information Apache sends to the browser about itself and the operating system, via Apache's [`ServerTokens`][] directive. Defaults to 'OS'. |
|
1115 |
|
1116 ##### `service_enable` |
|
1117 |
|
1118 Determines whether Puppet enables the Apache HTTPD service when the system is booted. Valid options: Boolean. Default: 'true'. |
|
1119 |
|
1120 ##### `service_ensure` |
|
1121 |
|
1122 Determines whether Puppet should make sure the service is running. Valid options: 'true' (equivalent to 'running'), 'false' (equivalent to 'stopped'). Default: 'running'. |
|
1123 |
|
1124 The 'false' or 'stopped' values set the 'httpd' service resource's `ensure` parameter to 'false', which is useful when you want to let the service be managed by another application, such as Pacemaker. |
|
1125 |
|
1126 ##### `service_name` |
|
1127 |
|
1128 Sets the name of the Apache service. Default: determined by your operating system. |
|
1129 |
|
1130 - **Debian and Gentoo**: `apache2` |
|
1131 - **FreeBSD**: `apache22` |
|
1132 - **Red Hat**: `httpd` |
|
1133 |
|
1134 ##### `service_manage` |
|
1135 |
|
1136 Determines whether Puppet manages the HTTPD service's state. Default: 'true'. |
|
1137 |
|
1138 ##### `service_restart` |
|
1139 |
|
1140 Determines whether Puppet should use a specific command to restart the HTTPD service. Valid options: a command to restart the Apache service. Default: 'undef', which uses the [default Puppet behavior][Service attribute restart]. |
|
1141 |
|
1142 ##### `timeout` |
|
1143 |
|
1144 Sets Apache's [`TimeOut`][] directive, which defines the number of seconds Apache waits for certain events before failing a request. Defaults to 120. |
|
1145 |
|
1146 ##### `trace_enable` |
|
1147 |
|
1148 Controls how Apache handles `TRACE` requests (per [RFC 2616][]) via the [`TraceEnable`][] directive. Valid options: 'Off', 'On'. Default: 'On'. |
|
1149 |
|
1150 ##### `use_systemd` |
|
1151 |
|
1152 Controls whether the systemd module should be installed on Centos 7 servers, this is especially useful if using custom built rpms. This can either be 'true' or 'false, defaults to 'true'. |
|
1153 |
|
1154 ##### `vhost_dir` |
|
1155 |
|
1156 Changes your virtual host configuration files' location. Default: determined by your operating system. |
|
1157 |
|
1158 - **Debian**: `/etc/apache2/sites-available` |
|
1159 - **FreeBSD**: `/usr/local/etc/apache22/Vhosts` |
|
1160 - **Gentoo**: `/etc/apache2/vhosts.d` |
|
1161 - **Red Hat**: `/etc/httpd/conf.d` |
|
1162 |
|
1163 ##### `vhost_include_pattern` |
|
1164 |
|
1165 Defines the pattern for files included from the `vhost_dir`. This defaults to '*', also for BC with previous versions of this module. |
|
1166 |
|
1167 However, you may want to set this to a value like '[^.#]\*.conf[^~]' to make sure files accidentally created in this directory (from version |
|
1168 control systems, editor backups or the like) are *not* included in your server configuration. |
|
1169 |
|
1170 A value of '*.conf' is what is shipped by some operating systems. Also note that this module will, by default, create config files ending |
|
1171 in '.conf'. |
|
1172 |
|
1173 ##### `user` |
|
1174 |
|
1175 Changes the user Apache uses to answer requests. Apache's parent process will continue to be run as root, but child processes will access resources as the user defined by this parameter. |
|
1176 |
|
1177 Default: Puppet sets the default value via the [`apache::params`][] class, which manages the user based on your operating system: |
|
1178 |
|
1179 - **Debian**: 'www-data' |
|
1180 - **FreeBSD**: 'www' |
|
1181 - **Gentoo** and **Red Hat**: 'apache' |
|
1182 |
|
1183 To prevent Puppet from managing the user, set the [`manage_user`][] parameter to 'false'. |
|
1184 |
|
1185 ##### `apache_name` |
|
1186 |
|
1187 The name of the Apache package to install. Default: Puppet sets the default value via the [`apache::params`][] class, which manages the user based on your operating system: |
|
1188 |
|
1189 The default value is determined by your operating system: |
|
1190 |
|
1191 - **Debian**: 'apache2' |
|
1192 - **FreeBSD**: 'apache24' |
|
1193 - **Gentoo**: 'www-servers/apache' |
|
1194 - **Red Hat**: 'httpd' |
|
1195 |
|
1196 You might need to override this if you are using a non-standard Apache package, such as those from Red Hat's software collections. |
|
1197 |
|
1198 #### Class: `apache::dev` |
|
1199 |
|
1200 Installs Apache development libraries. By default, the package name is defined by the [`dev_packages`][] parameter of the [`apache::params`][] class based on your operating system: |
|
1201 |
|
1202 The default value is determined by your operating system: |
|
1203 |
|
1204 - **Debian** : 'libaprutil1-dev', 'libapr1-dev'; 'apache2-dev' on Ubuntu 13.10 and Debian 8; 'apache2-prefork-dev' on other versions |
|
1205 - **FreeBSD**: 'undef'; see note below |
|
1206 - **Gentoo**: 'undef' |
|
1207 - **Red Hat**: 'httpd-devel' |
|
1208 |
|
1209 **Note**: On FreeBSD, you must declare the `apache::package` or `apache` classes before declaring `apache::dev`. |
|
1210 |
|
1211 #### Classes: `apache::mod::<MODULE NAME>` |
|
1212 |
|
1213 Enables specific [Apache modules][]. You can enable and configure an Apache module by declaring its class. For example, to install and enable [`mod_alias`][] with no icons, you can declare the [`apache::mod::alias`][] class with the `icons_options` parameter set to 'None': |
|
1214 |
|
1215 ~~~ puppet |
|
1216 class { 'apache::mod::alias': |
|
1217 icons_options => 'None', |
|
1218 } |
|
1219 ~~~ |
|
1220 |
|
1221 The following Apache modules have supported classes, many of which allow for parameterized configuration. You can install other Apache modules with the [`apache::mod`][] define. |
|
1222 |
|
1223 * `actions` |
|
1224 * `alias` (see [`apache::mod::alias`][]) |
|
1225 * `auth_basic` |
|
1226 * `auth_cas`* (see [`apache::mod::auth_cas`][]) |
|
1227 * `auth_mellon`* (see [`apache::mod::auth_mellon`][]) |
|
1228 * `auth_kerb` |
|
1229 * `authn_core` |
|
1230 * `authn_file` |
|
1231 * `authnz_ldap`* |
|
1232 * `authz_default` |
|
1233 * `authz_user` |
|
1234 * `autoindex` |
|
1235 * `cache` |
|
1236 * `cgi` |
|
1237 * `cgid` |
|
1238 * `dav` |
|
1239 * `dav_fs` |
|
1240 * `dav_svn`* |
|
1241 * `deflate` |
|
1242 * `dev` |
|
1243 * `dir`* |
|
1244 * `disk_cache` (see [`apache::mod::disk_cache`][]) |
|
1245 * `event` (see [`apache::mod::event`][]) |
|
1246 * `expires` |
|
1247 * `ext_filter` (see [`apache::mod::ext_filter`][]) |
|
1248 * `fastcgi` |
|
1249 * `fcgid` |
|
1250 * `filter` |
|
1251 * `geoip` (see [`apache::mod::geoip`][]) |
|
1252 * `headers` |
|
1253 * `include` |
|
1254 * `info`* |
|
1255 * `itk` |
|
1256 * `ldap` |
|
1257 * `mime` |
|
1258 * `mime_magic`* |
|
1259 * `negotiation` |
|
1260 * `nss`* |
|
1261 * `pagespeed` (see [`apache::mod::pagespeed`][]) |
|
1262 * `passenger`* |
|
1263 * `perl` |
|
1264 * `peruser` |
|
1265 * `php` (requires [`mpm_module`][] set to `prefork`) |
|
1266 * `prefork`* |
|
1267 * `proxy`* |
|
1268 * `proxy_ajp` |
|
1269 * `proxy_balancer` |
|
1270 * `proxy_html` |
|
1271 * `proxy_http` |
|
1272 * `python` |
|
1273 * `reqtimeout` |
|
1274 * `remoteip`* |
|
1275 * `rewrite` |
|
1276 * `rpaf`* |
|
1277 * `setenvif` |
|
1278 * `security` |
|
1279 * `shib`* (see [`apache::mod::shib`]) |
|
1280 * `speling` |
|
1281 * `ssl`* (see [`apache::mod::ssl`][]) |
|
1282 * `status`* (see [`apache::mod::status`][]) |
|
1283 * `suphp` |
|
1284 * `userdir`* |
|
1285 * `version` |
|
1286 * `vhost_alias` |
|
1287 * `worker`* |
|
1288 * `wsgi` (see [`apache::mod::wsgi`][]) |
|
1289 * `xsendfile` |
|
1290 |
|
1291 Modules noted with a * indicate that the module has settings and a template that includes parameters to configure the module. Most Apache module class parameters have default values and don't require configuration. For modules with templates, Puppet installs template files with the module; these template files are required for the module to work. |
|
1292 |
|
1293 ##### Class: `apache::mod::alias` |
|
1294 |
|
1295 Installs and manages [`mod_alias`][]. |
|
1296 |
|
1297 **Parameters within `apache::mod::alias`**: |
|
1298 |
|
1299 * `icons_options`: Disables directory listings for the icons directory, via Apache [`Options`] directive. Default: 'Indexes MultiViews'. |
|
1300 * `icons_path`: Sets the local path for an `/icons/` Alias. Default: depends on your operating system. |
|
1301 |
|
1302 - **Debian**: `/usr/share/apache2/icons` |
|
1303 - **FreeBSD**: `/usr/local/www/apache24/icons` |
|
1304 - **Gentoo**: `/var/www/icons` |
|
1305 - **Red Hat**: `/var/www/icons`, except on Apache 2.4, where it's `/usr/share/httpd/icons` |
|
1306 |
|
1307 #### Class: `apache::mod::disk_cache` |
|
1308 |
|
1309 Installs and configures [`mod_disk_cache`][] on Apache 2.2, or [`mod_cache_disk`][] on Apache 2.4. The default cache root depends on the Apache version and operating system: |
|
1310 |
|
1311 - **Debian**: `/var/cache/apache2/mod_cache_disk` |
|
1312 - **FreeBSD**: `/var/cache/mod_cache_disk` |
|
1313 - **Red Hat, Apache 2.4**: `/var/cache/httpd/proxy` |
|
1314 - **Red Hat, Apache 2.2**: `/var/cache/mod_proxy` |
|
1315 |
|
1316 You can specify the cache root by passing a path as a string to the `cache_root` parameter. |
|
1317 |
|
1318 ~~~ puppet |
|
1319 class {'::apache::mod::disk_cache': |
|
1320 cache_root => '/path/to/cache', |
|
1321 } |
|
1322 ~~~ |
|
1323 |
|
1324 ##### Class: `apache::mod::event` |
|
1325 |
|
1326 Installs and manages [`mod_mpm_event`][]. You can't include both `apache::mod::event` and [`apache::mod::itk`][], [`apache::mod::peruser`][], [`apache::mod::prefork`][], or [`apache::mod::worker`][] on the same server. |
|
1327 |
|
1328 **Parameters within `apache::mod::event`**: |
|
1329 |
|
1330 - `listenbacklog`: Sets the maximum length of the pending connections queue via the module's [`ListenBackLog`][] directive. Default: '511'. |
|
1331 - `maxclients` (_Apache 2.3.12 or older_: `maxrequestworkers`): Sets the maximum number of connections Apache can simultaneously process, via the module's [`MaxRequestWorkers`][] directive. Default: '150'. |
|
1332 - `maxconnectionsperchild` (_Apache 2.3.8 or older_: `maxrequestsperchild`): Limits the number of connections a child server handles during its life, via the module's [`MaxConnectionsPerChild`][] directive. Default: '0'. |
|
1333 - `maxsparethreads` and `minsparethreads`: Sets the maximum and minimum number of idle threads, via the [`MaxSpareThreads`][] and [`MinSpareThreads`][] directives. Default: '75' and '25', respectively. |
|
1334 - `serverlimit`: Limits the configurable number of processes via the [`ServerLimit`][] directive. Default: '25'. |
|
1335 - `startservers`: Sets the number of child server processes created at startup, via the module's [`StartServers`][] directive. Default: '2'. |
|
1336 - `threadlimit`: Limits the number of event threads via the module's [`ThreadLimit`][] directive. Default: '64'. |
|
1337 - `threadsperchild`: Sets the number of threads created by each child process, via the [`ThreadsPerChild`][] directive. Default: '25'. |
|
1338 |
|
1339 ##### Class: `apache::mod::auth_cas` |
|
1340 |
|
1341 Installs and manages [`mod_auth_cas`][]. Its parameters share names with the Apache module's directives. |
|
1342 |
|
1343 The `cas_login_url` and `cas_validate_url` parameters are required; several other parameters have 'undef' default values. |
|
1344 |
|
1345 **Parameters within `apache::mod::auth_cas`**: |
|
1346 |
|
1347 - `cas_authoritative`: Determines whether an optional authorization directive is authoritative and binding. Default: 'undef'. |
|
1348 - `cas_certificate_path`: Sets the path to the X509 certificate of the Certificate Authority for the server in `cas_login_url` and `cas_validate_url`. Default: 'undef'. |
|
1349 - `cas_cache_clean_interval`: Sets the minimum number of seconds that must pass between cache cleanings. Default: 'undef'. |
|
1350 - `cas_cookie_domain`: Sets the value of the `Domain=` parameter in the `Set-Cookie` HTTP header. Default: 'undef'. |
|
1351 - `cas_cookie_entropy`: Sets the number of bytes to use when creating session identifiers. Default: 'undef'. |
|
1352 - `cas_cookie_http_only`: Sets the optional `HttpOnly` flag when `mod_auth_cas` issues cookies. Default: 'undef'. |
|
1353 - `cas_debug`: Determines whether to enable the module's debugging mode. Default: 'Off'. |
|
1354 - `cas_idle_timeout`: Default: 'undef'. |
|
1355 - `cas_login_url`: **Required**. Sets the URL to which the module redirects users when they attempt to access a CAS-protected resource and don't have an active session. |
|
1356 - `cas_root_proxied_as`: Sets the URL end users see when access to this Apache server is proxied. Default: 'undef'. |
|
1357 - `cas_timeout`: Limits the number of seconds a `mod_auth_cas` session can remain active. Default: 'undef'. |
|
1358 - `cas_validate_depth`: Limits the depth for chained certificate validation. Default: 'undef'. |
|
1359 - `cas_validate_url`: **Required**. Sets the URL to use when validating a client-presented ticket in an HTTP query string. |
|
1360 - `cas_version`: The CAS protocol version to adhere to. Valid options: '1', '2'. Default: '2'. |
|
1361 |
|
1362 ##### Class: `apache::mod::auth_mellon` |
|
1363 |
|
1364 Installs and manages [`mod_auth_mellon`][]. Its parameters share names with the Apache module's directives. |
|
1365 |
|
1366 ~~~ puppet |
|
1367 class{ 'apache::mod::auth_mellon': |
|
1368 mellon_cache_size => 101, |
|
1369 } |
|
1370 ~~~ |
|
1371 |
|
1372 **Parameters within `apache::mod::auth_mellon`**: |
|
1373 |
|
1374 - `mellon_cache_entry_size`: Maximum size for a single session. Default: 'undef'. |
|
1375 - `mellon_cache_size`: Size in megabytes of the mellon cache. Default: 100. |
|
1376 - `mellon_lock_file`: Location of lock file. Default: '`/run/mod_auth_mellon/lock`'. |
|
1377 - `mellon_post_directory`: Full path where post requests are saved. Default: '`/var/cache/apache2/mod_auth_mellon/`' |
|
1378 - `mellon_post_ttl`: Time to keep post requests. Default: 'undef'. |
|
1379 - `mellon_post_size`: Maximum size of post requests. Default: 'undef'. |
|
1380 - `mellon_post_count`: Maximum number of post requests. Default: 'undef'. |
|
1381 |
|
1382 ##### Class: `apache::mod::deflate` |
|
1383 |
|
1384 Installs and configures [`mod_deflate`][]. |
|
1385 |
|
1386 **Parameters within `apache::mod::deflate`**: |
|
1387 |
|
1388 - `types`: An [array][] of [MIME types][MIME `content-type`] to be deflated. Default: [ 'text/html text/plain text/xml', 'text/css', 'application/x-javascript application/javascript application/ecmascript', 'application/rss+xml', 'application/json' ]. |
|
1389 - `notes`: A [Hash][] where the key represents the type and the value represents the note name. Default: { 'Input' => 'instream', 'Output' => 'outstream', 'Ratio' => 'ratio' } |
|
1390 |
|
1391 ##### Class: `apache::mod::expires` |
|
1392 |
|
1393 Installs [`mod_expires`][] and uses the `expires.conf.erb` template to generate its configuration. |
|
1394 |
|
1395 **Parameters within `apache::mod::expires`**: |
|
1396 |
|
1397 - `expires_active`: Enables generation of `Expires` headers for a document realm. Default: 'true'. |
|
1398 - `expires_default`: Default algorithm for calculating expiration time using [`ExpiresByType`][] syntax or [interval syntax][]. Default: undef. |
|
1399 - `expires_by_type`: Describes a set of [MIME `content-type`][] and their expiration times. Valid options: An [array][] of [Hashes][Hash], with each Hash's key a valid MIME `content-type` (i.e. 'text/json') and its value following valid [interval syntax][]. Default: undef. |
|
1400 |
|
1401 ##### Class: `apache::mod::ext_filter` |
|
1402 |
|
1403 Installs and configures [`mod_ext_filter`][]. |
|
1404 |
|
1405 ~~~ puppet |
|
1406 class { 'apache::mod::ext_filter': |
|
1407 ext_filter_define => { |
|
1408 'slowdown' => 'mode=output cmd=/bin/cat preservescontentlength', |
|
1409 'puppetdb-strip' => 'mode=output outtype=application/json cmd="pdb-resource-filter"', |
|
1410 }, |
|
1411 } |
|
1412 ~~~ |
|
1413 |
|
1414 **Parameters within `apache::mod::ext_filter`**: |
|
1415 |
|
1416 - `ext_filter_define`: A hash of filter names and their parameters. Default: undef. |
|
1417 |
|
1418 ##### Class: `apache::mod::fcgid` |
|
1419 |
|
1420 Installs and configures [`mod_fcgid`][]. |
|
1421 |
|
1422 The class makes no effort to individually parameterize all available options. Instead, configure `mod_fcgid` using the `options` [hash][]. For example: |
|
1423 |
|
1424 ~~~ puppet |
|
1425 class { 'apache::mod::fcgid': |
|
1426 options => { |
|
1427 'FcgidIPCDir' => '/var/run/fcgidsock', |
|
1428 'SharememPath' => '/var/run/fcgid_shm', |
|
1429 'AddHandler' => 'fcgid-script .fcgi', |
|
1430 }, |
|
1431 } |
|
1432 ~~~ |
|
1433 |
|
1434 For a full list of options, see the [official `mod_fcgid` documentation][`mod_fcgid`]. |
|
1435 |
|
1436 If you include `apache::mod::fcgid`, you can set the [`FcgidWrapper`][] per directory, per virtual host. The module must be loaded first; Puppet will not automatically enable it if you set the `fcgiwrapper` parameter in `apache::vhost`. |
|
1437 |
|
1438 ~~~ puppet |
|
1439 include apache::mod::fcgid |
|
1440 |
|
1441 apache::vhost { 'example.org': |
|
1442 docroot => '/var/www/html', |
|
1443 directories => { |
|
1444 path => '/var/www/html', |
|
1445 fcgiwrapper => { |
|
1446 command => '/usr/local/bin/fcgiwrapper', |
|
1447 } |
|
1448 }, |
|
1449 } |
|
1450 ~~~ |
|
1451 |
|
1452 ##### Class: `apache::mod::geoip` |
|
1453 |
|
1454 Installs and manages [`mod_geoip`][]. |
|
1455 |
|
1456 **Parameters within `apache::mod::geoip`**: |
|
1457 |
|
1458 - `db_file`: Sets the path to your GeoIP database file. Valid options: a path, or an [array][] paths for multiple GeoIP database files. Default: `/usr/share/GeoIP/GeoIP.dat`. |
|
1459 - `enable`: Determines whether to globally enable [`mod_geoip`][]. Valid options: Boolean. Default: 'false'. |
|
1460 - `flag`: Sets the GeoIP flag. Valid options: 'CheckCache', 'IndexCache', 'MemoryCache', 'Standard'. Default: 'Standard'. |
|
1461 - `output`: Defines which output variables to use. Valid options: 'All', 'Env', 'Request', 'Notes'. Default: 'All'. |
|
1462 - `enable_utf8`: Changes the output from ISO-8859-1 (Latin-1) to UTF-8. Valid options: Boolean. Default: 'undef'. |
|
1463 - `scan_proxy_headers`: Enables the [GeoIPScanProxyHeaders][] option. Valid options: Boolean. Default: 'undef'. |
|
1464 - `scan_proxy_header_field`: Specifies which header [`mod_geoip`][] should look at to determine the client's IP address. Default: 'undef'. |
|
1465 - `use_last_xforwarededfor_ip` (sic): Determines whether to use the first or last IP address for the client's IP if a comma-separated list of IP addresses is found. Valid options: Boolean. Default: 'undef'. |
|
1466 |
|
1467 ##### Class: `apache::mod::info` |
|
1468 |
|
1469 Installs and manages [`mod_info`][], which provides a comprehensive overview of the server configuration. |
|
1470 |
|
1471 **Parameters within `apache::mod::info`**: |
|
1472 |
|
1473 - `allow_from`: Whitelist of IPv4 or IPv6 addresses or ranges that can access `/server-info`. Valid options: One or more octets of an IPv4 address, an IPv6 address or range, or an array of either. Default: ['127.0.0.1','::1'] |
|
1474 - `apache_version`: Default: `$::apache::apache_version`, |
|
1475 - `restrict_access`: Determines whether to enable access restrictions. If 'false', the `allow_from` whitelist is ignored and any IP address can access `/server-info`. Valid options: Boolean. Default: 'true'. |
|
1476 |
|
1477 ##### Class: `apache::mod::negotiation` |
|
1478 |
|
1479 Installs and configures [`mod_negotiation`][]. |
|
1480 |
|
1481 **Parameters within `apache::mod::negotiation`:** |
|
1482 |
|
1483 - `force_language_priority`: Sets the `ForceLanguagePriority` option. Valid option: String. Default: `Prefer Fallback`. |
|
1484 - `language_priority`: An [array][] of languages to set the `LanguagePriority` option of the module. Default: [ 'en', 'ca', 'cs', 'da', 'de', 'el', 'eo', 'es', 'et', 'fr', 'he', 'hr', 'it', 'ja', 'ko', 'ltz', 'nl', 'nn', 'no', 'pl', 'pt', 'pt-BR', 'ru', 'sv', 'zh-CN', 'zh-TW' ] |
|
1485 |
|
1486 ##### Class: `apache::mod::pagespeed` |
|
1487 |
|
1488 Installs and manages [`mod_pagespeed`], a Google module that rewrites web pages to reduce latency and bandwidth. |
|
1489 |
|
1490 While this Apache module requires the `mod-pagespeed-stable` package, Puppet **doesn't** manage the software repositories required to automatically install the package. If you declare this class when the package is either not installed or not available to your package manager, your Puppet run will fail. |
|
1491 |
|
1492 **Parameters within `apache::mod::info`**: |
|
1493 |
|
1494 - `inherit_vhost_config`: Default: 'on'. |
|
1495 - `filter_xhtml`: Default: false. |
|
1496 - `cache_path`: Default: '/var/cache/mod_pagespeed/'. |
|
1497 - `log_dir`: Default: '/var/log/pagespeed'. |
|
1498 - `memcache_servers`: Default: []. |
|
1499 - `rewrite_level`: Default: 'CoreFilters'. |
|
1500 - `disable_filters`: Default: []. |
|
1501 - `enable_filters`: Default: []. |
|
1502 - `forbid_filters`: Default: []. |
|
1503 - `rewrite_deadline_per_flush_ms`: Default: 10. |
|
1504 - `additional_domains`: Default: undef. |
|
1505 - `file_cache_size_kb`: Default: 102400. |
|
1506 - `file_cache_clean_interval_ms`: Default: 3600000. |
|
1507 - `lru_cache_per_process`: Default: 1024. |
|
1508 - `lru_cache_byte_limit`: Default: 16384. |
|
1509 - `css_flatten_max_bytes`: Default: 2048. |
|
1510 - `css_inline_max_bytes`: Default: 2048. |
|
1511 - `css_image_inline_max_bytes`: Default: 2048. |
|
1512 - `image_inline_max_bytes`: Default: 2048. |
|
1513 - `js_inline_max_bytes`: Default: 2048. |
|
1514 - `css_outline_min_bytes`: Default: 3000. |
|
1515 - `js_outline_min_bytes`: Default: 3000. |
|
1516 - `inode_limit`: Default: 500000. |
|
1517 - `image_max_rewrites_at_once`: Default: 8. |
|
1518 - `num_rewrite_threads`: Default: 4. |
|
1519 - `num_expensive_rewrite_threads`: Default: 4. |
|
1520 - `collect_statistics`: Default: 'on'. |
|
1521 - `statistics_logging`: Default: 'on'. |
|
1522 - `allow_view_stats`: Default: []. |
|
1523 - `allow_pagespeed_console`: Default: []. |
|
1524 - `allow_pagespeed_message`: Default: []. |
|
1525 - `message_buffer_size`: Default: 100000. |
|
1526 - `additional_configuration`: Default: { }. |
|
1527 |
|
1528 The class's parameters correspond to the module's directives. See the [module's documentation][`mod_pagespeed`] for details. |
|
1529 |
|
1530 ##### Class: `apache::mod::php` |
|
1531 |
|
1532 Installs and configures [`mod_php`][]. |
|
1533 |
|
1534 **Parameters within `apache::mod::php`**: |
|
1535 |
|
1536 Default values depend on your operating system. |
|
1537 |
|
1538 > **Note**: This list is incomplete. Most of this class's parameters correspond to `mod_php` directives; see the [module's documentation][`mod_php`] for details. |
|
1539 |
|
1540 - `package_name`: Names the package that installs `php_mod`. |
|
1541 - `path`: Defines the path to the `mod_php` shared object (`.so`) file. |
|
1542 - `source`: Defines the path to the default configuration. Valid options include a `puppet:///` path. |
|
1543 - `template`: Defines the path to the `php.conf` template Puppet uses to generate the configuration file. |
|
1544 - `content`: Adds arbitrary content to `php.conf`. |
|
1545 |
|
1546 ##### Class: `apache::mod::reqtimeout` |
|
1547 |
|
1548 Installs and configures [`mod_reqtimeout`][]. |
|
1549 |
|
1550 **Parameters within `apache::mod::reqtimeout`**: |
|
1551 |
|
1552 - `timeouts`: A string or [array][] that sets the [`RequestReadTimeout`][] option. Default: ['header=20-40,MinRate=500', 'body=20,MinRate=500']. |
|
1553 |
|
1554 ##### Class: `apache::mod::shib` |
|
1555 |
|
1556 Installs the [Shibboleth](http://shibboleth.net/) Apache module `mod_shib`, which enables SAML2 single sign-on (SSO) authentication by Shibboleth Identity Providers and Shibboleth Federations. This class only installs and configures the Apache components of a web application that consumes Shibboleth SSO identities, also known as a Shibboleth Service Provider. You can manage the Shibboleth configuration manually, with Puppet, or using a [Shibboleth Puppet Module](https://github.com/aethylred/puppet-shibboleth). |
|
1557 |
|
1558 Defining this class enables Shibboleth-specific parameters in `apache::vhost` instances. |
|
1559 |
|
1560 ##### Class: `apache::mod::ssl` |
|
1561 |
|
1562 Installs [Apache SSL features][`mod_ssl`] and uses the `ssl.conf.erb` template to generate its configuration. |
|
1563 |
|
1564 **Parameters within `apache::mod::ssl`**: |
|
1565 |
|
1566 - `ssl_cipher`: Default: 'HIGH:MEDIUM:!aNULL:!MD5:!RC4'. |
|
1567 - `ssl_compression`: Default: 'false'. |
|
1568 - `ssl_cryptodevice`: Default: 'builtin'. |
|
1569 - `ssl_honorcipherorder`: Default: 'On'. |
|
1570 - `ssl_openssl_conf_cmd`: Default: 'undef'. |
|
1571 - `ssl_options`: Default: [ 'StdEnvVars' ] |
|
1572 - `ssl_pass_phrase_dialog`: Default: 'builtin'. |
|
1573 - `ssl_protocol`: Default: [ 'all', '-SSLv2', '-SSLv3' ]. |
|
1574 - `ssl_random_seed_bytes`: Default: '512'. |
|
1575 - `ssl_sessioncachetimeout`: Default: '300'. |
|
1576 |
|
1577 To use SSL with a virtual host, you must either set the [`default_ssl_vhost`][] parameter in `::apache` to 'true' **o**r the [`ssl`][] parameter in [`apache::vhost`][] to 'true'. |
|
1578 |
|
1579 ##### Class: `apache::mod::status` |
|
1580 |
|
1581 Installs [`mod_status`][] and uses the `status.conf.erb` template to generate its configuration. |
|
1582 |
|
1583 **Parameters within `apache::mod::status`**: |
|
1584 |
|
1585 - `allow_from`: An [array][] of IPv4 or IPv6 addresses that can access `/server-status`. Default: ['127.0.0.1','::1']. |
|
1586 - `extended_status`: Determines whether to track extended status information for each request, via the [`ExtendedStatus`][] directive. Valid options: 'Off', 'On'. Default: 'On'. |
|
1587 - `status_path`: The server location of the status page. Default: '/server-status'. |
|
1588 |
|
1589 ##### Class: `apache::mod::version` |
|
1590 |
|
1591 Installs [`mod_version`][] on many operating systems and Apache configurations. |
|
1592 |
|
1593 If Debian and Ubuntu systems with Apache 2.4 are classified with `apache::mod::version`, Puppet warns that `mod_version` is built-in and can't be loaded. |
|
1594 |
|
1595 ##### Class: `apache::mod::security` |
|
1596 |
|
1597 Installs and configures Trustwave's [`mod_security`][]. It is enabled and runs by default on all virtual hosts. |
|
1598 |
|
1599 **Parameters within `apache::mod::security`**: |
|
1600 |
|
1601 - `activated_rules`: An [array][] of rules from the `modsec_crs_path` to activate via symlinks. Default: `modsec_default_rules` in [`apache::params`][]. |
|
1602 - `allowed_methods`: A space-separated list of allowed HTTP methods. Default: 'GET HEAD POST OPTIONS'. |
|
1603 - `content_types`: A list of one or more allowed [MIME types][MIME `content-type`]. Default: 'application/x-www-form-urlencoded|multipart/form-data|text/xml|application/xml|application/x-amf' |
|
1604 - `crs_package`: Names the package that installs CRS rules. Default: `modsec_crs_package` in [`apache::params`][]. |
|
1605 - `modsec_dir`: Defines the path where Puppet installs the modsec configuration and activated rules links. Default: 'On', set by `modsec_dir` in [`apache::params`][]. |
|
1606 ${modsec_dir}/activated_rules. |
|
1607 - `modsec_secruleengine`: Configures the modsec rules engine. Valid options: 'On', 'Off', and 'DetectionOnly'. Default: `modsec_secruleengine` in [`apache::params`][]. |
|
1608 - `restricted_extensions`: A space-separated list of prohibited file extensions. Default: '.asa/ .asax/ .ascx/ .axd/ .backup/ .bak/ .bat/ .cdx/ .cer/ .cfg/ .cmd/ .com/ .config/ .conf/ .cs/ .csproj/ .csr/ .dat/ .db/ .dbf/ .dll/ .dos/ .htr/ .htw/ .ida/ .idc/ .idq/ .inc/ .ini/ .key/ .licx/ .lnk/ .log/ .mdb/ .old/ .pass/ .pdb/ .pol/ .printer/ .pwd/ .resources/ .resx/ .sql/ .sys/ .vb/ .vbs/ .vbproj/ .vsdisco/ .webinfo/ .xsd/ .xsx/'. |
|
1609 - `restricted_headers`: A list of restricted headers separated by slashes and spaces. Default: 'Proxy-Connection/ /Lock-Token/ /Content-Range/ /Translate/ /via/ /if/'. |
|
1610 |
|
1611 ##### Class: `apache::mod::wsgi` |
|
1612 |
|
1613 Enables Python support via [`mod_wsgi`][]. |
|
1614 |
|
1615 **Parameters within `apache::mod::wsgi`**: |
|
1616 |
|
1617 - `mod_path`: Defines the path to the `mod_wsgi` shared object (`.so`) file. Default: undef. |
|
1618 - If the `mod_path` parameter doesn't contain `/`, Puppet prefixes it with your operating system's default module path. |
|
1619 Otherwise, Puppet follows it literally. |
|
1620 - `package_name`: Names the package that installs `mod_wsgi`. Default: undef. |
|
1621 - `wsgi_python_home`: Defines the [`WSGIPythonHome`][] directive, such as '/path/to/venv'. Valid options: path. Default: undef. |
|
1622 - `wsgi_python_path`: Defines the [`WSGIPythonPath`][] directive, such as '/path/to/venv/site-packages'. Valid options: path. Default: undef. |
|
1623 - `wsgi_socket_prefix`: Defines the [`WSGISocketPrefix`][] directive, such as "\${APACHE_RUN_DIR}WSGI". Default: `wsgi_socket_prefix` in [`apache::params`][]. |
|
1624 |
|
1625 The class's parameters correspond to the module's directives. See the [module's documentation][`mod_wsgi`] for details. |
|
1626 |
|
1627 ### Private Classes |
|
1628 |
|
1629 #### Class: `apache::confd::no_accf` |
|
1630 |
|
1631 Creates the `no-accf.conf` configuration file in `conf.d`, required by FreeBSD's Apache 2.4. |
|
1632 |
|
1633 #### Class: `apache::default_confd_files` |
|
1634 |
|
1635 Includes `conf.d` files for FreeBSD. |
|
1636 |
|
1637 #### Class: `apache::default_mods` |
|
1638 |
|
1639 Installs the Apache modules required to run the default configuration. See the `apache` class's [`default_mods`][] parameter for details. |
|
1640 |
|
1641 #### Class: `apache::package` |
|
1642 |
|
1643 Installs and configures basic Apache packages. |
|
1644 |
|
1645 #### Class: `apache::params` |
|
1646 |
|
1647 Manages Apache parameters for different operating systems. |
|
1648 |
|
1649 #### Class: `apache::service` |
|
1650 |
|
1651 Manages the Apache daemon. |
|
1652 |
|
1653 #### Class: `apache::version` |
|
1654 |
|
1655 Attempts to automatically detect the Apache version based on the operating system. |
|
1656 |
|
1657 ### Public Defines |
|
1658 |
|
1659 #### Define: `apache::balancer` |
|
1660 |
|
1661 Creates an Apache load balancing group, also known as a balancer cluster, using [`mod_proxy`][]. Each load balancing group needs one or more balancer members, which you can declare in Puppet with the [`apache::balancermember`][] define. |
|
1662 |
|
1663 Declare one `apache::balancer` define for each Apache load balancing group. You can export `apache::balancermember` defines for all balancer members and collect them on a single Apache load balancer server using [exported resources][]. |
|
1664 |
|
1665 **Parameters within `apache::balancer`**: |
|
1666 |
|
1667 ##### `name` |
|
1668 |
|
1669 Sets the title of the balancer cluster and name of the `conf.d` file containing its configuration. |
|
1670 |
|
1671 ##### `proxy_set` |
|
1672 |
|
1673 Configures key-value pairs as [`ProxySet`][] lines. Valid options: [Hash][]. Default: '{}'. |
|
1674 |
|
1675 ##### `collect_exported` |
|
1676 |
|
1677 Determines whether to use [exported resources][]. Valid options: Boolean. Default: 'true'. |
|
1678 |
|
1679 If you statically declare all of your backend servers, set this parameter to 'false' to rely on existing, declared balancer member resources. Also, use `apache::balancermember` with [array][] arguments. |
|
1680 |
|
1681 To dynamically declare backend servers via exported resources collected on a central node, set this parameter to 'true' to collect the balancer member resources exported by the balancer member nodes. |
|
1682 |
|
1683 If you don't use exported resources, a single Puppet run configures all balancer members. If you use exported resources, Puppet has to run on the balanced nodes first, then run on the balancer. |
|
1684 |
|
1685 #### Define: `apache::balancermember` |
|
1686 |
|
1687 Defines members of [`mod_proxy_balancer`][], which sets up a balancer member inside a listening service configuration block in the load balancer's `apache.cfg`. |
|
1688 |
|
1689 **Parameters within `apache::balancermember`**: |
|
1690 |
|
1691 ##### `balancer_cluster` |
|
1692 |
|
1693 **Required**. Sets the Apache service's instance name, and must match the name of a declared [`apache::balancer`][] resource. |
|
1694 |
|
1695 ##### `url` |
|
1696 |
|
1697 Specifies the URL used to contact the balancer member server. Default: 'http://${::fqdn}/'. |
|
1698 |
|
1699 ##### `options` |
|
1700 |
|
1701 Specifies an [array][] of [options](http://httpd.apache.org/docs/current/mod/mod_proxy.html#balancermember) after the URL, and accepts any key-value pairs available to [`ProxyPass`][]. Default: an empty array. |
|
1702 |
|
1703 #### Define: `apache::custom_config` |
|
1704 |
|
1705 Adds a custom configuration file to the Apache server's `conf.d` directory. If the file is invalid and this define's `$verify_config` parameter is 'true', Puppet throws an error during a Puppet run. |
|
1706 |
|
1707 **Parameters within `apache::custom_config`**: |
|
1708 |
|
1709 ##### `ensure` |
|
1710 |
|
1711 Specifies whether the configuration file should be present. Valid options: 'absent', 'present'. Default: 'present'. |
|
1712 |
|
1713 ##### `confdir` |
|
1714 |
|
1715 Sets the directory in which Puppet places configuration files. Default: '$::apache::confd_dir'. |
|
1716 |
|
1717 ##### `content` |
|
1718 |
|
1719 Sets the configuration file's content. The `content` and [`source`][] parameters are exclusive of each other. |
|
1720 |
|
1721 ##### `priority` |
|
1722 |
|
1723 Sets the configuration file's priority by prefixing its filename with this parameter's numeric value, as Apache processes configuration files in alphanumeric order. The default value is `25`. |
|
1724 |
|
1725 To omit the priority prefix in the configuration file's name, set this parameter to `false`. |
|
1726 |
|
1727 ##### `source` |
|
1728 |
|
1729 Points to the configuration file's source. The [`content`][] and `source` parameters are exclusive of each other. |
|
1730 |
|
1731 ##### `verify_command` |
|
1732 |
|
1733 Specifies the command Puppet uses to verify the configuration file. Use a fully qualified command. Default: `/usr/sbin/apachectl -t`. |
|
1734 |
|
1735 This parameter is only used if the [`verify_config`][] parameter's value is 'true'. If the `verify_command` fails, the Puppet run deletes the configuration file, does not notify the Apache service, and raises an error. |
|
1736 |
|
1737 ##### `verify_config` |
|
1738 |
|
1739 Specifies whether to validate the configuration file before notifying the Apache service. Valid options: Boolean. Default: `true`. |
|
1740 |
|
1741 #### Define: `apache::fastcgi::server` |
|
1742 |
|
1743 Defines one or more external FastCGI servers to handle specific file types. Use this define with [`mod_fastcgi`][FastCGI]. |
|
1744 |
|
1745 **Parameters within `apache::fastcgi::server`:** |
|
1746 |
|
1747 ##### `host` |
|
1748 |
|
1749 Determines the FastCGI's hostname or IP address and TCP port number (1-65535). |
|
1750 |
|
1751 ##### `timeout` |
|
1752 |
|
1753 Sets the number of seconds a [FastCGI][] application can be inactive before aborting the request and logging the event at the error LogLevel. The inactivity timer applies only as long as a connection is pending with the FastCGI application. If a request is queued to an application, but the application doesn't respond by writing and flushing within this period, the request is aborted. If communication is complete with the application but incomplete with the client (the response is buffered), the timeout does not apply. |
|
1754 |
|
1755 ##### `flush` |
|
1756 |
|
1757 Forces [`mod_fastcgi`][FastCGI] to write to the client as data is received from the application. By default, `mod_fastcgi` buffers data in order to free the application as quickly as possible. |
|
1758 |
|
1759 ##### `faux_path` |
|
1760 |
|
1761 Apache has [FastCGI][] handle URIs that resolve to this filename. The path set in this parameter does not have to exist in the local filesystem. |
|
1762 |
|
1763 ##### `alias` |
|
1764 |
|
1765 Internally links actions with the FastCGI server. This alias must be unique. |
|
1766 |
|
1767 ##### `file_type` |
|
1768 |
|
1769 Sets the [MIME `content-type`][] of the file to be processed by the FastCGI server. |
|
1770 |
|
1771 #### Define: `apache::listen` |
|
1772 |
|
1773 Adds [`Listen`][] directives to `ports.conf` in the Apache configuration directory that define the Apache server's or a virtual host's listening address and port. The [`apache::vhost`][] class uses this define, and titles take the form '<PORT>', '<IPV4>:<PORT>', or '<IPV6>:<PORT>'. |
|
1774 |
|
1775 #### Define: `apache::mod` |
|
1776 |
|
1777 Installs packages for an Apache module that doesn't have a corresponding [`apache::mod::<MODULE NAME>`][] class, and checks for or places the module's default configuration files in the Apache server's `module` and `enable` directories. The default locations depend on your operating system. |
|
1778 |
|
1779 **Parameters within `apache::mod`**: |
|
1780 |
|
1781 ##### `package` |
|
1782 |
|
1783 **Required**. Names the package Puppet uses to install the Apache module. |
|
1784 |
|
1785 ##### `package_ensure` |
|
1786 |
|
1787 Determines whether Puppet ensures the Apache module should be installed. Valid options: 'absent', 'present'. Default: 'present'. |
|
1788 |
|
1789 ##### `lib` |
|
1790 |
|
1791 Defines the module's shared object name. Its default value is `mod_$name.so`, and it should not be configured manually without special reason. |
|
1792 |
|
1793 ##### `lib_path` |
|
1794 |
|
1795 Specifies a path to the module's libraries. Default: the `apache` class's [`lib_path`][] parameter. |
|
1796 |
|
1797 Don't manually set this parameter without special reason. The [`path`][] parameter overrides this value. |
|
1798 |
|
1799 ##### `loadfile_name` |
|
1800 |
|
1801 Sets the filename for the module's [`LoadFile`][] directive, which can also set the module load order as Apache processes them in alphanumeric order. Valid options: filenames formatted `\*.load`. Default: `$name.load`. |
|
1802 |
|
1803 ##### `loadfiles` |
|
1804 |
|
1805 Specifies an [array][] of [`LoadFile`][] directives. |
|
1806 |
|
1807 ##### `path` |
|
1808 |
|
1809 Specifies a path to the module. Default: [`lib_path`][]/[`lib`][]. Don't manually set this parameter without special reason. |
|
1810 |
|
1811 #### Define: `apache::namevirtualhost` |
|
1812 |
|
1813 Enables [name-based virtual hosts][] and adds all related directives to the `ports.conf` file in the Apache HTTPD configuration directory. Titles can take the forms '\*', '*:<PORT>', '\_default_:<PORT>, '<IP>', or '<IP>:<PORT>'. |
|
1814 |
|
1815 #### Define: `apache::vhost` |
|
1816 |
|
1817 The Apache module allows a lot of flexibility in the setup and configuration of virtual hosts. This flexibility is due, in part, to `vhost` being a defined resource type, which allows Apache to evaluate it multiple times with different parameters. |
|
1818 |
|
1819 The `apache::vhost` define allows you to have specialized configurations for virtual hosts that have requirements outside the defaults. You can set up a default virtual host within the base `::apache` class, as well as set a customized virtual host as the default. Customized virtual hosts have a lower numeric [`priority`][] than the base class's, causing Apache to process the customized virtual host first. |
|
1820 |
|
1821 The `apache::vhost` define uses `concat::fragment` to build the configuration file. To inject custom fragments for pieces of the configuration that the define doesn't inherently support, add a custom fragment. |
|
1822 |
|
1823 For the custom fragment's `order` parameter, the `apache::vhost` define uses multiples of 10, so any `order` that isn't a multiple of 10 should work. |
|
1824 |
|
1825 **Parameters within `apache::vhost`**: |
|
1826 |
|
1827 ##### `access_log` |
|
1828 |
|
1829 Determines whether to configure `*_access.log` directives (`*_file`,`*_pipe`, or `*_syslog`). Valid options: Boolean. Default: 'true'. |
|
1830 |
|
1831 ##### `access_log_env_var` |
|
1832 |
|
1833 Specifies that only requests with particular environment variables be logged. Defaults to 'undef'. |
|
1834 |
|
1835 ##### `access_log_file` |
|
1836 |
|
1837 Sets the filename of the `*_access.log` placed in [`logroot`][]. Given a virtual host---for instance, example.com---it defaults to 'example.com_ssl.log' for [SSL-encrypted][SSL encryption] virtual hosts and 'example.com_access.log' for unencrypted virtual hosts. |
|
1838 |
|
1839 ##### `access_log_format` |
|
1840 |
|
1841 Specifies the use of either a [`LogFormat`][] nickname or a custom-formatted string for the access log. Default: 'combined'. |
|
1842 |
|
1843 ##### `access_log_pipe` |
|
1844 |
|
1845 Specifies a pipe where Apache sends access log messages. Default: 'undef'. |
|
1846 |
|
1847 ##### `access_log_syslog` |
|
1848 |
|
1849 Sends all access log messages to syslog. Default: 'undef'. |
|
1850 |
|
1851 ##### `add_default_charset` |
|
1852 |
|
1853 Sets a default media charset value for the [`AddDefaultCharset`][] directive, which is added to `text/plain` and `text/html` responses. |
|
1854 |
|
1855 ##### `add_listen` |
|
1856 |
|
1857 Determines whether the virtual host creates a [`Listen`][] statement. Valid options: Boolean. Default: 'true'. |
|
1858 |
|
1859 Setting `add_listen` to 'false' prevents the virtual host from creating a `Listen` statement. This is important when combining virtual hosts that aren't passed an `ip` parameter with those that are. |
|
1860 |
|
1861 ##### `use_optional_includes` |
|
1862 |
|
1863 Specifies whether Apache uses the [`IncludeOptional`][] directive instead of [`Include`][] for `additional_includes` in Apache 2.4 or newer. Valid options: Boolean. Default: 'false'. |
|
1864 |
|
1865 ##### `additional_includes` |
|
1866 |
|
1867 Specifies paths to additional static, virtual host-specific Apache configuration files. You can use this parameter to implement a unique, custom configuration not supported by this module. Valid options: a string path or [array][] of them. Default: an empty array. |
|
1868 |
|
1869 ##### `aliases` |
|
1870 |
|
1871 Passes a list of [Hashes][Hash] to the virtual host to create [`Alias`][], [`AliasMatch`][], [`ScriptAlias`][] or [`ScriptAliasMatch`][] directives as per the [`mod_alias`][] documentation. |
|
1872 |
|
1873 For example: |
|
1874 |
|
1875 ~~~ puppet |
|
1876 aliases => [ |
|
1877 { aliasmatch => '^/image/(.*)\.jpg$', |
|
1878 path => '/files/jpg.images/$1.jpg', |
|
1879 }, |
|
1880 { alias => '/image', |
|
1881 path => '/ftp/pub/image', |
|
1882 }, |
|
1883 { scriptaliasmatch => '^/cgi-bin(.*)', |
|
1884 path => '/usr/local/share/cgi-bin$1', |
|
1885 }, |
|
1886 { scriptalias => '/nagios/cgi-bin/', |
|
1887 path => '/usr/lib/nagios/cgi-bin/', |
|
1888 }, |
|
1889 { alias => '/nagios', |
|
1890 path => '/usr/share/nagios/html', |
|
1891 }, |
|
1892 ], |
|
1893 ~~~ |
|
1894 |
|
1895 For the `alias`, `aliasmatch`, `scriptalias` and `scriptaliasmatch` keys to work, each needs a corresponding context, such as `<Directory /path/to/directory>` or `<Location /some/location/here>`. Puppet creates the directives in the order specified in the `aliases` parameter. As described in the [`mod_alias`][] documentation, add more specific `alias`, `aliasmatch`, `scriptalias` or `scriptaliasmatch` parameters before the more general ones to avoid shadowing. |
|
1896 |
|
1897 **Note**: Use the `aliases` parameter instead of the `scriptaliases` parameter because you can precisely control the various alias directives' order. Defining `ScriptAliases` using the `scriptaliases` parameter means *all* `ScriptAlias` directives will come after *all* `Alias` directives, which can lead to `Alias` directives shadowing `ScriptAlias` directives. This often causes problems, for example with Nagios. |
|
1898 |
|
1899 If [`apache::mod::passenger`][] is loaded and `PassengerHighPerformance` is 'true', the `Alias` directive might not be able to honor the `PassengerEnabled => off` statement. See [this article](http://www.conandalton.net/2010/06/passengerenabled-off-not-working.html) for details. |
|
1900 |
|
1901 ##### `allow_encoded_slashes` |
|
1902 |
|
1903 Sets the [`AllowEncodedSlashes`][] declaration for the virtual host, overriding the server default. This modifies the virtual host responses to URLs with `\` and `/` characters. Valid options: 'nodecode', 'off', 'on'. Default: undef, which omits the declaration from the server configuration and selects the Apache default setting of `Off`. |
|
1904 |
|
1905 ##### `block` |
|
1906 |
|
1907 Specifies the list of things to which Apache blocks access. Valid option: 'scm', which blocks web access to `.svn`, `.git`, and `.bzr` directories. Default: an empty [array][]. |
|
1908 |
|
1909 ##### `custom_fragment` |
|
1910 |
|
1911 Passes a string of custom configuration directives to place at the end of the virtual host configuration. Default: 'undef'. |
|
1912 |
|
1913 ##### `default_vhost` |
|
1914 |
|
1915 Sets a given `apache::vhost` define as the default to serve requests that do not match any other `apache::vhost` defines. Default: 'false'. |
|
1916 |
|
1917 ##### `directories` |
|
1918 |
|
1919 See the [`directories`](#parameter-directories-for-apachevhost) section. |
|
1920 |
|
1921 ##### `directoryindex` |
|
1922 |
|
1923 Sets the list of resources to look for when a client requests an index of the directory by specifying a '/' at the end of the directory name. See the [`DirectoryIndex`][] directive documentation for details. Default: 'undef'. |
|
1924 |
|
1925 ##### `docroot` |
|
1926 |
|
1927 **Required**. Sets the [`DocumentRoot`][] location, from which Apache serves files. |
|
1928 |
|
1929 If `docroot` and [`manage_docroot`][] are both set to `false`, no [`DocumentRoot`][] will be set and the accompanying `<Directory /path/to/directory>` block will not be created. |
|
1930 |
|
1931 ##### `docroot_group` |
|
1932 |
|
1933 Sets group access to the [`docroot`][] directory. Defaults to 'root'. |
|
1934 |
|
1935 ##### `docroot_owner` |
|
1936 |
|
1937 Sets individual user access to the docroot directory. Defaults to 'root'. |
|
1938 |
|
1939 ##### `docroot_mode` |
|
1940 |
|
1941 Sets access permissions of the docroot directory. Defaults to 'undef'. |
|
1942 |
|
1943 ##### `manage_docroot` |
|
1944 |
|
1945 Whether to manage to docroot directory at all. Defaults to 'true'. |
|
1946 |
|
1947 ##### `error_log` |
|
1948 |
|
1949 Specifies whether `*_error.log` directives should be configured. Defaults to 'true'. |
|
1950 |
|
1951 ##### `error_log_file` |
|
1952 |
|
1953 Points to the `*_error.log` file. Given a vhost, example.com, it defaults to 'example.com_ssl_error.log' for SSL vhosts and 'example.com_access_error.log' for non-SSL vhosts. |
|
1954 |
|
1955 ##### `error_log_pipe` |
|
1956 |
|
1957 Specifies a pipe to send error log messages to. Defaults to 'undef'. |
|
1958 |
|
1959 ##### `error_log_syslog` |
|
1960 |
|
1961 Sends all error log messages to syslog. Defaults to 'undef'. |
|
1962 |
|
1963 ##### `error_documents` |
|
1964 |
|
1965 A list of hashes which can be used to override the [ErrorDocument](https://httpd.apache.org/docs/current/mod/core.html#errordocument) settings for this vhost. Defaults to '[]'. Example: |
|
1966 |
|
1967 ~~~ puppet |
|
1968 apache::vhost { 'sample.example.net': |
|
1969 error_documents => [ |
|
1970 { 'error_code' => '503', 'document' => '/service-unavail' }, |
|
1971 { 'error_code' => '407', 'document' => 'https://example.com/proxy/login' }, |
|
1972 ], |
|
1973 } |
|
1974 ~~~ |
|
1975 |
|
1976 ##### `ensure` |
|
1977 |
|
1978 Specifies if the vhost file is present or absent. Defaults to 'present'. |
|
1979 |
|
1980 ##### `fallbackresource` |
|
1981 |
|
1982 Sets the [FallbackResource](http://httpd.apache.org/docs/current/mod/mod_dir.html#fallbackresource) directive, which specifies an action to take for any URL that doesn't map to anything in your filesystem and would otherwise return 'HTTP 404 (Not Found)'. Valid values must either begin with a / or be 'disabled'. Defaults to 'undef'. |
|
1983 |
|
1984 ##### `filters` |
|
1985 |
|
1986 [Filters](http://httpd.apache.org/docs/2.2/mod/mod_filter.html) enable smart, context-sensitive configuration of output content filters. |
|
1987 |
|
1988 ~~~ puppet |
|
1989 apache::vhost { "$::fqdn": |
|
1990 filters => [ |
|
1991 'FilterDeclare COMPRESS', |
|
1992 'FilterProvider COMPRESS DEFLATE resp=Content-Type $text/html', |
|
1993 'FilterChain COMPRESS', |
|
1994 'FilterProtocol COMPRESS DEFLATE change=yes;byteranges=no', |
|
1995 ], |
|
1996 } |
|
1997 ~~~ |
|
1998 |
|
1999 ##### `force_type` |
|
2000 |
|
2001 Sets the [`ForceType`][] directive, which forces Apache to serve all matching files with the specified [MIME `content-type`][]. |
|
2002 |
|
2003 ##### `headers` |
|
2004 |
|
2005 Adds lines to replace, merge, or remove response headers. See [Header](http://httpd.apache.org/docs/current/mod/mod_headers.html#header) for more information. Can be an array. Defaults to 'undef'. |
|
2006 |
|
2007 ##### `ip` |
|
2008 |
|
2009 Sets the IP address the vhost listens on. Defaults to listen on all IPs. |
|
2010 |
|
2011 ##### `ip_based` |
|
2012 |
|
2013 Enables an [IP-based](http://httpd.apache.org/docs/current/vhosts/ip-based.html) vhost. This parameter inhibits the creation of a NameVirtualHost directive, since those are used to funnel requests to name-based vhosts. Defaults to 'false'. |
|
2014 |
|
2015 ##### `itk` |
|
2016 |
|
2017 Configures [ITK](http://mpm-itk.sesse.net/) in a hash. Keys can be: |
|
2018 |
|
2019 * user + group |
|
2020 * `assignuseridexpr` |
|
2021 * `assigngroupidexpr` |
|
2022 * `maxclientvhost` |
|
2023 * `nice` |
|
2024 * `limituidrange` (Linux 3.5.0 or newer) |
|
2025 * `limitgidrange` (Linux 3.5.0 or newer) |
|
2026 |
|
2027 Usage typically looks like: |
|
2028 |
|
2029 ~~~ puppet |
|
2030 apache::vhost { 'sample.example.net': |
|
2031 docroot => '/path/to/directory', |
|
2032 itk => { |
|
2033 user => 'someuser', |
|
2034 group => 'somegroup', |
|
2035 }, |
|
2036 } |
|
2037 ~~~ |
|
2038 |
|
2039 ##### `auth_kerb` |
|
2040 |
|
2041 Enable [`mod_auth_kerb`][] parameters for a virtual host. Valid values are 'true' or 'false'. Defaults to 'false'. |
|
2042 |
|
2043 Usage typically looks like: |
|
2044 |
|
2045 ~~~ puppet |
|
2046 apache::vhost { 'sample.example.net': |
|
2047 auth_kerb => true, |
|
2048 krb_method_negotiate => 'on', |
|
2049 krb_auth_realms => ['EXAMPLE.ORG'], |
|
2050 krb_local_user_mapping => 'on', |
|
2051 directories => { |
|
2052 path => '/var/www/html', |
|
2053 auth_name => 'Kerberos Login', |
|
2054 auth_type => 'Kerberos', |
|
2055 auth_require => 'valid-user', |
|
2056 }, |
|
2057 } |
|
2058 ~~~ |
|
2059 |
|
2060 Related parameters follow the names of `mod_auth_kerb` directives: |
|
2061 |
|
2062 - `krb_method_negotiate`: Determines whether to use the Negotiate method. Default: 'on'. |
|
2063 - `krb_method_k5passwd`: Determines whether to use password-based authentication for Kerberos v5. Default: 'on'. |
|
2064 - `krb_authoritative`: If set to 'off', authentication controls can be passed on to another module. Default: 'on'. |
|
2065 - `krb_auth_realms`: Specifies an array of Kerberos realms to use for authentication. Default: `[]`. |
|
2066 - `krb_5keytab`: Specifies the Kerberos v5 keytab file's location. Default: undef. |
|
2067 - `krb_local_user_mapping`: Strips @REALM from usernames for further use. Default: undef. |
|
2068 |
|
2069 ##### `limit_request_field_size` |
|
2070 |
|
2071 [Limits](http://httpd.apache.org/docs/2.4/mod/core.html#limitrequestfieldsize) the size of the HTTP request header allowed from the client. Default is 'undef'. |
|
2072 |
|
2073 ##### `logroot` |
|
2074 |
|
2075 Specifies the location of the virtual host's logfiles. Defaults to '/var/log/<apache log location>/'. |
|
2076 |
|
2077 ##### `$logroot_ensure` |
|
2078 |
|
2079 Determines whether or not to remove the logroot directory for a virtual host. Valid values are 'directory', or 'absent'. |
|
2080 |
|
2081 ##### `logroot_mode` |
|
2082 |
|
2083 Overrides the mode the logroot directory is set to. Defaults to undef. Do NOT give people write access to the directory the logs are stored |
|
2084 in without being aware of the consequences; see http://httpd.apache.org/docs/2.4/logs.html#security for details. |
|
2085 |
|
2086 ##### `log_level` |
|
2087 |
|
2088 Specifies the verbosity of the error log. Defaults to 'warn' for the global server configuration and can be overridden on a per-vhost basis. Valid values are 'emerg', 'alert', 'crit', 'error', 'warn', 'notice', 'info' or 'debug'. |
|
2089 |
|
2090 ###### `modsec_body_limit` |
|
2091 |
|
2092 Configures the maximum request body size (in bytes) ModSecurity will accept for buffering |
|
2093 |
|
2094 ###### `modsec_disable_vhost` |
|
2095 |
|
2096 Boolean. Only valid if apache::mod::security is included. Used to disable mod_security on an individual vhost. Only relevant if apache::mod::security is included. |
|
2097 |
|
2098 ###### `modsec_disable_ids` |
|
2099 |
|
2100 Array of mod_security IDs to remove from the vhost. Also takes a hash allowing removal of an ID from a specific location. |
|
2101 |
|
2102 ~~~ puppet |
|
2103 apache::vhost { 'sample.example.net': |
|
2104 modsec_disable_ids => [ 90015, 90016 ], |
|
2105 } |
|
2106 ~~~ |
|
2107 |
|
2108 ~~~ puppet |
|
2109 apache::vhost { 'sample.example.net': |
|
2110 modsec_disable_ids => { '/location1' => [ 90015, 90016 ] }, |
|
2111 } |
|
2112 ~~~ |
|
2113 |
|
2114 ###### `modsec_disable_ips` |
|
2115 |
|
2116 Array of IPs to exclude from mod_security rule matching |
|
2117 |
|
2118 ##### `no_proxy_uris` |
|
2119 |
|
2120 Specifies URLs you do not want to proxy. This parameter is meant to be used in combination with [`proxy_dest`](#proxy_dest). |
|
2121 |
|
2122 ##### `no_proxy_uris_match` |
|
2123 |
|
2124 This directive is equivalent to `no_proxy_uris`, but takes regular expressions. |
|
2125 |
|
2126 ##### `proxy_preserve_host` |
|
2127 |
|
2128 Sets the [ProxyPreserveHost Directive](http://httpd.apache.org/docs/current/mod/mod_proxy.html#proxypreservehost). Valid options: Boolean. Default: 'false'. |
|
2129 |
|
2130 Setting this parameter to 'true' enables the `Host:` line from an incoming request to be proxied to the host instead of hostname. 'false' sets this option to 'Off'. |
|
2131 |
|
2132 ##### `proxy_error_override` |
|
2133 |
|
2134 Sets the [ProxyErrorOverride Directive](http://httpd.apache.org/docs/current/mod/mod_proxy.html#proxyerroroverride). This directive controls whether apache should override error pages for proxied content. This option is off by default. |
|
2135 |
|
2136 ##### `options` |
|
2137 |
|
2138 Sets the [`Options`][] for the specified virtual host. Default: ['Indexes','FollowSymLinks','MultiViews'], as demonstrated below: |
|
2139 |
|
2140 ~~~ puppet |
|
2141 apache::vhost { 'site.name.fdqn': |
|
2142 … |
|
2143 options => ['Indexes','FollowSymLinks','MultiViews'], |
|
2144 } |
|
2145 ~~~ |
|
2146 |
|
2147 **Note**: If you use the [`directories`][] parameter of [`apache::vhost`][], 'Options', 'Override', and 'DirectoryIndex' are ignored because they are parameters within `directories`. |
|
2148 |
|
2149 ##### `override` |
|
2150 |
|
2151 Sets the overrides for the specified virtual host. Accepts an array of [AllowOverride](http://httpd.apache.org/docs/current/mod/core.html#allowoverride) arguments. Defaults to '[none]'. |
|
2152 |
|
2153 ##### `passenger_app_root` |
|
2154 |
|
2155 Sets [PassengerRoot](https://www.phusionpassenger.com/documentation/Users%20guide%20Apache.html#PassengerAppRoot), the location of the Passenger application root if different from the DocumentRoot. |
|
2156 |
|
2157 ##### `passenger_app_env` |
|
2158 |
|
2159 Sets [PassengerAppEnv](https://www.phusionpassenger.com/documentation/Users%20guide%20Apache.html#PassengerAppEnv), the environment for the Passenger application. If not specifies, defaults to the global setting or 'production'. |
|
2160 |
|
2161 ##### `passenger_ruby` |
|
2162 |
|
2163 Sets [PassengerRuby](https://www.phusionpassenger.com/documentation/Users%20guide%20Apache.html#PassengerRuby) on this virtual host, the Ruby interpreter to use for the application. |
|
2164 |
|
2165 ##### `passenger_min_instances` |
|
2166 |
|
2167 Sets [PassengerMinInstances](https://www.phusionpassenger.com/documentation/Users%20guide%20Apache.html#PassengerMinInstances), the minimum number of application processes to run. |
|
2168 |
|
2169 ##### `passenger_start_timeout` |
|
2170 |
|
2171 Sets [PassengerStartTimeout](https://www.phusionpassenger.com/documentation/Users%20guide%20Apache.html#_passengerstarttimeout_lt_seconds_gt), the timeout for the application startup. |
|
2172 |
|
2173 ##### `passenger_pre_start` |
|
2174 |
|
2175 Sets [PassengerPreStart](https://www.phusionpassenger.com/documentation/Users%20guide%20Apache.html#PassengerPreStart), the URL of the application if pre-starting is required. |
|
2176 |
|
2177 ##### `php_flags & values` |
|
2178 |
|
2179 Allows per-vhost setting [`php_value`s or `php_flag`s](http://php.net/manual/en/configuration.changes.php). These flags or values can be overwritten by a user or an application. Defaults to '{}'. |
|
2180 |
|
2181 ##### `php_admin_flags & values` |
|
2182 |
|
2183 Allows per-vhost setting [`php_admin_value`s or `php_admin_flag`s](http://php.net/manual/en/configuration.changes.php). These flags or values cannot be overwritten by a user or an application. Defaults to '{}'. |
|
2184 |
|
2185 ##### `port` |
|
2186 |
|
2187 Sets the port the host is configured on. The module's defaults ensure the host listens on port 80 for non-SSL vhosts and port 443 for SSL vhosts. The host only listens on the port set in this parameter. |
|
2188 |
|
2189 ##### `priority` |
|
2190 |
|
2191 Sets the relative load-order for Apache HTTPD VirtualHost configuration files. Defaults to '25'. |
|
2192 |
|
2193 If nothing matches the priority, the first name-based vhost is used. Likewise, passing a higher priority causes the alphabetically first name-based vhost to be used if no other names match. |
|
2194 |
|
2195 *Note:* You should not need to use this parameter. However, if you do use it, be aware that the `default_vhost` parameter for `apache::vhost` passes a priority of '15'. |
|
2196 |
|
2197 Pass priority `false` to omit the priority prefix in file names. |
|
2198 |
|
2199 ##### `proxy_dest` |
|
2200 |
|
2201 Specifies the destination address of a [ProxyPass](http://httpd.apache.org/docs/current/mod/mod_proxy.html#proxypass) configuration. Defaults to 'undef'. |
|
2202 |
|
2203 ##### `proxy_pass` |
|
2204 |
|
2205 Specifies an array of `path => URI` for a [ProxyPass](http://httpd.apache.org/docs/current/mod/mod_proxy.html#proxypass) configuration. Defaults to 'undef'. Optionally parameters can be added as an array. |
|
2206 |
|
2207 ~~~ puppet |
|
2208 apache::vhost { 'site.name.fdqn': |
|
2209 … |
|
2210 proxy_pass => [ |
|
2211 { 'path' => '/a', 'url' => 'http://backend-a/' }, |
|
2212 { 'path' => '/b', 'url' => 'http://backend-b/' }, |
|
2213 { 'path' => '/c', 'url' => 'http://backend-a/c', 'params' => {'max'=>20, 'ttl'=>120, 'retry'=>300}}, |
|
2214 { 'path' => '/l', 'url' => 'http://backend-xy', |
|
2215 'reverse_urls' => ['http://backend-x', 'http://backend-y'] }, |
|
2216 { 'path' => '/d', 'url' => 'http://backend-a/d', |
|
2217 'params' => { 'retry' => '0', 'timeout' => '5' }, }, |
|
2218 { 'path' => '/e', 'url' => 'http://backend-a/e', |
|
2219 'keywords' => ['nocanon', 'interpolate'] }, |
|
2220 { 'path' => '/f', 'url' => 'http://backend-f/', |
|
2221 'setenv' => ['proxy-nokeepalive 1','force-proxy-request-1.0 1']}, |
|
2222 { 'path' => '/g', 'url' => 'http://backend-g/', |
|
2223 'reverse_cookies' => [{'path' => '/g', 'url' => 'http://backend-g/',}], }, |
|
2224 ], |
|
2225 } |
|
2226 ~~~ |
|
2227 |
|
2228 `reverse_urls` is optional and can be an array or a string. It is useful when used with `mod_proxy_balancer`. |
|
2229 `reverse_cookies` is optional and is used to set ProxyPassReverseCookiePath. |
|
2230 `params` is an optional parameter. It allows to provide the ProxyPass key=value parameters (Connection settings). |
|
2231 `setenv` is optional and is an array to set environment variables for the proxy directive, for details see http://httpd.apache.org/docs/current/mod/mod_proxy.html#envsettings |
|
2232 |
|
2233 ##### `proxy_dest_match` |
|
2234 |
|
2235 This directive is equivalent to proxy_dest, but takes regular expressions, see [ProxyPassMatch](http://httpd.apache.org/docs/current/mod/mod_proxy.html#proxypassmatch) for details. |
|
2236 |
|
2237 ##### `proxy_dest_reverse_match` |
|
2238 |
|
2239 Allows you to pass a ProxyPassReverse if `proxy_dest_match` is specified. See [ProxyPassReverse](http://httpd.apache.org/docs/current/mod/mod_proxy.html#proxypassreverse) for details. |
|
2240 |
|
2241 ##### `proxy_pass_match` |
|
2242 |
|
2243 This directive is equivalent to proxy_pass, but takes regular expressions, see [ProxyPassMatch](http://httpd.apache.org/docs/current/mod/mod_proxy.html#proxypassmatch) for details. |
|
2244 |
|
2245 ##### `rack_base_uris` |
|
2246 |
|
2247 Specifies the resource identifiers for a rack configuration. The file paths specified are listed as rack application roots for [Phusion Passenger](http://www.modrails.com/documentation/Users%20guide%20Apache.html#_railsbaseuri_and_rackbaseuri) in the _rack.erb template. Defaults to 'undef'. |
|
2248 |
|
2249 #####`passenger_base_uris` |
|
2250 |
|
2251 Used to specify that the given URI is a Phusion Passenger-served application. The file paths specified are listed as passenger application roots for [Phusion Passenger](https://www.phusionpassenger.com/documentation/Users%20guide%20Apache.html#PassengerBaseURI) in the _passenger_base_uris.erb template. Defaults to 'undef'. |
|
2252 |
|
2253 ##### `redirect_dest` |
|
2254 |
|
2255 Specifies the address to redirect to. Defaults to 'undef'. |
|
2256 |
|
2257 ##### `redirect_source` |
|
2258 |
|
2259 Specifies the source URIs that redirect to the destination specified in `redirect_dest`. If more than one item for redirect is supplied, the source and destination must be the same length, and the items are order-dependent. |
|
2260 |
|
2261 ~~~ puppet |
|
2262 apache::vhost { 'site.name.fdqn': |
|
2263 … |
|
2264 redirect_source => ['/images','/downloads'], |
|
2265 redirect_dest => ['http://img.example.com/','http://downloads.example.com/'], |
|
2266 } |
|
2267 ~~~ |
|
2268 |
|
2269 ##### `redirect_status` |
|
2270 |
|
2271 Specifies the status to append to the redirect. Defaults to 'undef'. |
|
2272 |
|
2273 ~~~ puppet |
|
2274 apache::vhost { 'site.name.fdqn': |
|
2275 … |
|
2276 redirect_status => ['temp','permanent'], |
|
2277 } |
|
2278 ~~~ |
|
2279 |
|
2280 ##### `redirectmatch_regexp` & `redirectmatch_status` & `redirectmatch_dest` |
|
2281 |
|
2282 Determines which server status should be raised for a given regular expression and where to forward the user to. Entered as arrays. Defaults to 'undef'. |
|
2283 |
|
2284 ~~~ puppet |
|
2285 apache::vhost { 'site.name.fdqn': |
|
2286 … |
|
2287 redirectmatch_status => ['404','404'], |
|
2288 redirectmatch_regexp => ['\.git(/.*|$)/','\.svn(/.*|$)'], |
|
2289 redirectmatch_dest => ['http://www.example.com/1','http://www.example.com/2'], |
|
2290 } |
|
2291 ~~~ |
|
2292 |
|
2293 ##### `request_headers` |
|
2294 |
|
2295 Modifies collected [request headers](http://httpd.apache.org/docs/current/mod/mod_headers.html#requestheader) in various ways, including adding additional request headers, removing request headers, etc. Defaults to 'undef'. |
|
2296 |
|
2297 ~~~ puppet |
|
2298 apache::vhost { 'site.name.fdqn': |
|
2299 … |
|
2300 request_headers => [ |
|
2301 'append MirrorID "mirror 12"', |
|
2302 'unset MirrorID', |
|
2303 ], |
|
2304 } |
|
2305 ~~~ |
|
2306 ##### `rewrites` |
|
2307 |
|
2308 Creates URL rewrite rules. Expects an array of hashes, and the hash keys can be any of 'comment', 'rewrite_base', 'rewrite_cond', 'rewrite_rule' or 'rewrite_map'. Defaults to 'undef'. |
|
2309 |
|
2310 For example, you can specify that anyone trying to access index.html is served welcome.html |
|
2311 |
|
2312 ~~~ puppet |
|
2313 apache::vhost { 'site.name.fdqn': |
|
2314 … |
|
2315 rewrites => [ { rewrite_rule => ['^index\.html$ welcome.html'] } ] |
|
2316 } |
|
2317 ~~~ |
|
2318 |
|
2319 The parameter allows rewrite conditions that, when true, execute the associated rule. For instance, if you wanted to rewrite URLs only if the visitor is using IE |
|
2320 |
|
2321 ~~~ puppet |
|
2322 apache::vhost { 'site.name.fdqn': |
|
2323 … |
|
2324 rewrites => [ |
|
2325 { |
|
2326 comment => 'redirect IE', |
|
2327 rewrite_cond => ['%{HTTP_USER_AGENT} ^MSIE'], |
|
2328 rewrite_rule => ['^index\.html$ welcome.html'], |
|
2329 }, |
|
2330 ], |
|
2331 } |
|
2332 ~~~ |
|
2333 |
|
2334 You can also apply multiple conditions. For instance, rewrite index.html to welcome.html only when the browser is Lynx or Mozilla (version 1 or 2) |
|
2335 |
|
2336 ~~~ puppet |
|
2337 apache::vhost { 'site.name.fdqn': |
|
2338 … |
|
2339 rewrites => [ |
|
2340 { |
|
2341 comment => 'Lynx or Mozilla v1/2', |
|
2342 rewrite_cond => ['%{HTTP_USER_AGENT} ^Lynx/ [OR]', '%{HTTP_USER_AGENT} ^Mozilla/[12]'], |
|
2343 rewrite_rule => ['^index\.html$ welcome.html'], |
|
2344 }, |
|
2345 ], |
|
2346 } |
|
2347 ~~~ |
|
2348 |
|
2349 Multiple rewrites and conditions are also possible |
|
2350 |
|
2351 ~~~ puppet |
|
2352 apache::vhost { 'site.name.fdqn': |
|
2353 … |
|
2354 rewrites => [ |
|
2355 { |
|
2356 comment => 'Lynx or Mozilla v1/2', |
|
2357 rewrite_cond => ['%{HTTP_USER_AGENT} ^Lynx/ [OR]', '%{HTTP_USER_AGENT} ^Mozilla/[12]'], |
|
2358 rewrite_rule => ['^index\.html$ welcome.html'], |
|
2359 }, |
|
2360 { |
|
2361 comment => 'Internet Explorer', |
|
2362 rewrite_cond => ['%{HTTP_USER_AGENT} ^MSIE'], |
|
2363 rewrite_rule => ['^index\.html$ /index.IE.html [L]'], |
|
2364 }, |
|
2365 { |
|
2366 rewrite_base => /apps/, |
|
2367 rewrite_rule => ['^index\.cgi$ index.php', '^index\.html$ index.php', '^index\.asp$ index.html'], |
|
2368 }, |
|
2369 { comment => 'Rewrite to lower case', |
|
2370 rewrite_cond => ['%{REQUEST_URI} [A-Z]'], |
|
2371 rewrite_map => ['lc int:tolower'], |
|
2372 rewrite_rule => ['(.*) ${lc:$1} [R=301,L]'], |
|
2373 }, |
|
2374 ], |
|
2375 } |
|
2376 ~~~ |
|
2377 |
|
2378 Refer to the [`mod_rewrite` documentation](http://httpd.apache.org/docs/current/mod/mod_rewrite.html) for more details on what is possible with rewrite rules and conditions. |
|
2379 |
|
2380 ##### `scriptalias` |
|
2381 |
|
2382 Defines a directory of CGI scripts to be aliased to the path '/cgi-bin', for example: '/usr/scripts'. Defaults to 'undef'. |
|
2383 |
|
2384 ##### `scriptaliases` |
|
2385 |
|
2386 **Note**: This parameter is deprecated in favor of the `aliases` parameter. |
|
2387 |
|
2388 Passes an array of hashes to the vhost to create either ScriptAlias or ScriptAliasMatch statements per the [`mod_alias` documentation](http://httpd.apache.org/docs/current/mod/mod_alias.html). |
|
2389 |
|
2390 ~~~ puppet |
|
2391 scriptaliases => [ |
|
2392 { |
|
2393 alias => '/myscript', |
|
2394 path => '/usr/share/myscript', |
|
2395 }, |
|
2396 { |
|
2397 aliasmatch => '^/foo(.*)', |
|
2398 path => '/usr/share/fooscripts$1', |
|
2399 }, |
|
2400 { |
|
2401 aliasmatch => '^/bar/(.*)', |
|
2402 path => '/usr/share/bar/wrapper.sh/$1', |
|
2403 }, |
|
2404 { |
|
2405 alias => '/neatscript', |
|
2406 path => '/usr/share/neatscript', |
|
2407 }, |
|
2408 ] |
|
2409 ~~~ |
|
2410 |
|
2411 The ScriptAlias and ScriptAliasMatch directives are created in the order specified. As with [Alias and AliasMatch](#aliases) directives, specify more specific aliases before more general ones to avoid shadowing. |
|
2412 |
|
2413 ##### `serveradmin` |
|
2414 |
|
2415 Specifies the email address Apache displays when it renders one of its error pages. Defaults to 'undef'. |
|
2416 |
|
2417 ##### `serveraliases` |
|
2418 |
|
2419 Sets the [ServerAliases](http://httpd.apache.org/docs/current/mod/core.html#serveralias) of the site. Defaults to '[]'. |
|
2420 |
|
2421 ##### `servername` |
|
2422 |
|
2423 Sets the servername corresponding to the hostname you connect to the virtual host at. Defaults to the title of the resource. |
|
2424 |
|
2425 ##### `setenv` |
|
2426 |
|
2427 Used by HTTPD to set environment variables for vhosts. Defaults to '[]'. |
|
2428 |
|
2429 Example: |
|
2430 |
|
2431 ~~~ puppet |
|
2432 apache::vhost { 'setenv.example.com': |
|
2433 setenv => ['SPECIAL_PATH /foo/bin'], |
|
2434 } |
|
2435 ~~~ |
|
2436 |
|
2437 ##### `setenvif` |
|
2438 |
|
2439 Used by HTTPD to conditionally set environment variables for vhosts. Defaults to '[]'. |
|
2440 |
|
2441 ##### `suphp_addhandler`, `suphp_configpath`, & `suphp_engine` |
|
2442 |
|
2443 Set up a virtual host with [suPHP](http://suphp.org/DocumentationView.html?file=apache/CONFIG). |
|
2444 |
|
2445 `suphp_addhandler` defaults to 'php5-script' on RedHat and FreeBSD, and 'x-httpd-php' on Debian and Gentoo. |
|
2446 |
|
2447 `suphp_configpath` defaults to 'undef' on RedHat and FreeBSD, and '/etc/php5/apache2' on Debian and Gentoo. |
|
2448 |
|
2449 `suphp_engine` allows values 'on' or 'off'. Defaults to 'off' |
|
2450 |
|
2451 To set up a virtual host with suPHP |
|
2452 |
|
2453 ~~~ puppet |
|
2454 apache::vhost { 'suphp.example.com': |
|
2455 port => '80', |
|
2456 docroot => '/home/appuser/myphpapp', |
|
2457 suphp_addhandler => 'x-httpd-php', |
|
2458 suphp_engine => 'on', |
|
2459 suphp_configpath => '/etc/php5/apache2', |
|
2460 directories => { path => '/home/appuser/myphpapp', |
|
2461 'suphp' => { user => 'myappuser', group => 'myappgroup' }, |
|
2462 } |
|
2463 } |
|
2464 ~~~ |
|
2465 |
|
2466 ##### `vhost_name` |
|
2467 |
|
2468 Enables name-based virtual hosting. If no IP is passed to the virtual host, but the vhost is assigned a port, then the vhost name is 'vhost_name:port'. If the virtual host has no assigned IP or port, the vhost name is set to the title of the resource. Defaults to '*'. |
|
2469 |
|
2470 ##### `virtual_docroot` |
|
2471 |
|
2472 Sets up a virtual host with a wildcard alias subdomain mapped to a directory with the same name. For example, 'http://example.com' would map to '/var/www/example.com'. Defaults to 'false'. |
|
2473 |
|
2474 ~~~ puppet |
|
2475 apache::vhost { 'subdomain.loc': |
|
2476 vhost_name => '*', |
|
2477 port => '80', |
|
2478 virtual_docroot' => '/var/www/%-2+', |
|
2479 docroot => '/var/www', |
|
2480 serveraliases => ['*.loc',], |
|
2481 } |
|
2482 ~~~ |
|
2483 |
|
2484 ##### `wsgi_daemon_process`, `wsgi_daemon_process_options`, `wsgi_process_group`, `wsgi_script_aliases`, & `wsgi_pass_authorization` |
|
2485 |
|
2486 Set up a virtual host with [WSGI](https://code.google.com/p/modwsgi/). |
|
2487 |
|
2488 `wsgi_daemon_process` sets the name of the WSGI daemon. It is a hash, accepting [these keys](http://modwsgi.readthedocs.org/en/latest/configuration-directives/WSGIDaemonProcess.html), and it defaults to 'undef'. |
|
2489 |
|
2490 `wsgi_daemon_process_options` is optional and defaults to 'undef'. |
|
2491 |
|
2492 `wsgi_process_group` sets the group ID the virtual host runs under. Defaults to 'undef'. |
|
2493 |
|
2494 `wsgi_script_aliases` requires a hash of web paths to filesystem .wsgi paths. Defaults to 'undef'. |
|
2495 |
|
2496 `wsgi_pass_authorization` the WSGI application handles authorisation instead of Apache when set to 'On'. For more information see [here] (http://modwsgi.readthedocs.org/en/latest/configuration-directives/WSGIPassAuthorization.html). Defaults to 'undef' where apache sets the defaults setting to 'Off'. |
|
2497 |
|
2498 `wsgi_chunked_request` enables support for chunked requests. Defaults to 'undef'. |
|
2499 |
|
2500 To set up a virtual host with WSGI |
|
2501 |
|
2502 ~~~ puppet |
|
2503 apache::vhost { 'wsgi.example.com': |
|
2504 port => '80', |
|
2505 docroot => '/var/www/pythonapp', |
|
2506 wsgi_daemon_process => 'wsgi', |
|
2507 wsgi_daemon_process_options => |
|
2508 { processes => '2', |
|
2509 threads => '15', |
|
2510 display-name => '%{GROUP}', |
|
2511 }, |
|
2512 wsgi_process_group => 'wsgi', |
|
2513 wsgi_script_aliases => { '/' => '/var/www/demo.wsgi' }, |
|
2514 wsgi_chunked_request => 'On', |
|
2515 } |
|
2516 ~~~ |
|
2517 |
|
2518 #### Parameter `directories` for `apache::vhost` |
|
2519 |
|
2520 The `directories` parameter within the `apache::vhost` class passes an array of hashes to the vhost to create [Directory](http://httpd.apache.org/docs/current/mod/core.html#directory), [File](http://httpd.apache.org/docs/current/mod/core.html#files), and [Location](http://httpd.apache.org/docs/current/mod/core.html#location) directive blocks. These blocks take the form, '< Directory /path/to/directory>...< /Directory>'. |
|
2521 |
|
2522 The `path` key sets the path for the directory, files, and location blocks. Its value must be a path for the 'directory', 'files', and 'location' providers, or a regex for the 'directorymatch', 'filesmatch', or 'locationmatch' providers. Each hash passed to `directories` **must** contain `path` as one of the keys. |
|
2523 |
|
2524 The `provider` key is optional. If missing, this key defaults to 'directory'. Valid values for `provider` are 'directory', 'files', 'location', 'directorymatch', 'filesmatch', or 'locationmatch'. If you set `provider` to 'directorymatch', it uses the keyword 'DirectoryMatch' in the Apache config file. |
|
2525 |
|
2526 General `directories` usage looks something like |
|
2527 |
|
2528 ~~~ puppet |
|
2529 apache::vhost { 'files.example.net': |
|
2530 docroot => '/var/www/files', |
|
2531 directories => [ |
|
2532 { 'path' => '/var/www/files', |
|
2533 'provider' => 'files', |
|
2534 'deny' => 'from all', |
|
2535 }, |
|
2536 ], |
|
2537 } |
|
2538 ~~~ |
|
2539 |
|
2540 *Note:* At least one directory should match the `docroot` parameter. After you start declaring directories, `apache::vhost` assumes that all required Directory blocks will be declared. If not defined, a single default Directory block is created that matches the `docroot` parameter. |
|
2541 |
|
2542 Available handlers, represented as keys, should be placed within the `directory`, `files`, or `location` hashes. This looks like |
|
2543 |
|
2544 ~~~ puppet |
|
2545 apache::vhost { 'sample.example.net': |
|
2546 docroot => '/path/to/directory', |
|
2547 directories => [ { path => '/path/to/directory', handler => value } ], |
|
2548 } |
|
2549 ~~~ |
|
2550 |
|
2551 Any handlers you do not set in these hashes are considered 'undefined' within Puppet and are not added to the virtual host, resulting in the module using their default values. Supported handlers are: |
|
2552 |
|
2553 ###### `addhandlers` |
|
2554 |
|
2555 Sets [AddHandler](http://httpd.apache.org/docs/current/mod/mod_mime.html#addhandler) directives, which map filename extensions to the specified handler. Accepts a list of hashes, with `extensions` serving to list the extensions being managed by the handler, and takes the form: `{ handler => 'handler-name', extensions => ['extension']}`. |
|
2556 |
|
2557 ~~~ puppet |
|
2558 apache::vhost { 'sample.example.net': |
|
2559 docroot => '/path/to/directory', |
|
2560 directories => [ |
|
2561 { path => '/path/to/directory', |
|
2562 addhandlers => [{ handler => 'cgi-script', extensions => ['.cgi']}], |
|
2563 }, |
|
2564 ], |
|
2565 } |
|
2566 ~~~ |
|
2567 |
|
2568 ###### `allow` |
|
2569 |
|
2570 Sets an [Allow](http://httpd.apache.org/docs/2.2/mod/mod_authz_host.html#allow) directive, which groups authorizations based on hostnames or IPs. **Deprecated:** This parameter is being deprecated due to a change in Apache. It only works with Apache 2.2 and lower. You can use it as a single string for one rule or as an array for more than one. |
|
2571 |
|
2572 ~~~ puppet |
|
2573 apache::vhost { 'sample.example.net': |
|
2574 docroot => '/path/to/directory', |
|
2575 directories => [ |
|
2576 { path => '/path/to/directory', |
|
2577 allow => 'from example.org', |
|
2578 }, |
|
2579 ], |
|
2580 } |
|
2581 ~~~ |
|
2582 |
|
2583 ###### `allow_override` |
|
2584 |
|
2585 Sets the types of directives allowed in [.htaccess](http://httpd.apache.org/docs/current/mod/core.html#allowoverride) files. Accepts an array. |
|
2586 |
|
2587 ~~~ puppet |
|
2588 apache::vhost { 'sample.example.net': |
|
2589 docroot => '/path/to/directory', |
|
2590 directories => [ |
|
2591 { path => '/path/to/directory', |
|
2592 allow_override => ['AuthConfig', 'Indexes'], |
|
2593 }, |
|
2594 ], |
|
2595 } |
|
2596 ~~~ |
|
2597 |
|
2598 ###### `auth_basic_authoritative` |
|
2599 |
|
2600 Sets the value for [AuthBasicAuthoritative](https://httpd.apache.org/docs/current/mod/mod_auth_basic.html#authbasicauthoritative), which determines whether authorization and authentication are passed to lower level Apache modules. |
|
2601 |
|
2602 ###### `auth_basic_fake` |
|
2603 |
|
2604 Sets the value for [AuthBasicFake](http://httpd.apache.org/docs/current/mod/mod_auth_basic.html#authbasicfake), which statically configures authorization credentials for a given directive block. |
|
2605 |
|
2606 ###### `auth_basic_provider` |
|
2607 |
|
2608 Sets the value for [AuthBasicProvider] (http://httpd.apache.org/docs/current/mod/mod_auth_basic.html#authbasicprovider), which sets the authentication provider for a given location. |
|
2609 |
|
2610 ###### `auth_digest_algorithm` |
|
2611 |
|
2612 Sets the value for [AuthDigestAlgorithm](http://httpd.apache.org/docs/current/mod/mod_auth_digest.html#authdigestalgorithm), which selects the algorithm used to calculate the challenge and response hashes. |
|
2613 |
|
2614 ###### `auth_digest_domain` |
|
2615 |
|
2616 Sets the value for [AuthDigestDomain](http://httpd.apache.org/docs/current/mod/mod_auth_digest.html#authdigestdomain), which allows you to specify one or more URIs in the same protection space for digest authentication. |
|
2617 |
|
2618 ###### `auth_digest_nonce_lifetime` |
|
2619 |
|
2620 Sets the value for [AuthDigestNonceLifetime](http://httpd.apache.org/docs/current/mod/mod_auth_digest.html#authdigestnoncelifetime), which controls how long the server nonce is valid. |
|
2621 |
|
2622 ###### `auth_digest_provider` |
|
2623 |
|
2624 Sets the value for [AuthDigestProvider](http://httpd.apache.org/docs/current/mod/mod_auth_digest.html#authdigestprovider), which sets the authentication provider for a given location. |
|
2625 |
|
2626 ###### `auth_digest_qop` |
|
2627 |
|
2628 Sets the value for [AuthDigestQop](http://httpd.apache.org/docs/current/mod/mod_auth_digest.html#authdigestqop), which determines the quality-of-protection to use in digest authentication. |
|
2629 |
|
2630 ###### `auth_digest_shmem_size` |
|
2631 |
|
2632 Sets the value for [AuthAuthDigestShmemSize](http://httpd.apache.org/docs/current/mod/mod_auth_digest.html#authdigestshmemsize), which defines the amount of shared memory allocated to the server for keeping track of clients. |
|
2633 |
|
2634 ###### `auth_group_file` |
|
2635 |
|
2636 Sets the value for [AuthGroupFile](https://httpd.apache.org/docs/current/mod/mod_authz_groupfile.html#authgroupfile), which sets the name of the text file containing the list of user groups for authorization. |
|
2637 |
|
2638 ###### `auth_name` |
|
2639 |
|
2640 Sets the value for [AuthName](http://httpd.apache.org/docs/current/mod/mod_authn_core.html#authname), which sets the name of the authorization realm. |
|
2641 |
|
2642 ###### `auth_require` |
|
2643 |
|
2644 Sets the entity name you're requiring to allow access. Read more about [Require](http://httpd.apache.org/docs/current/mod/mod_authz_host.html#requiredirectives). |
|
2645 |
|
2646 ###### `auth_type` |
|
2647 |
|
2648 Sets the value for [AuthType](http://httpd.apache.org/docs/current/mod/mod_authn_core.html#authtype), which guides the type of user authentication. |
|
2649 |
|
2650 ###### `auth_user_file` |
|
2651 |
|
2652 Sets the value for [AuthUserFile](http://httpd.apache.org/docs/current/mod/mod_authn_file.html#authuserfile), which sets the name of the text file containing the users/passwords for authentication. |
|
2653 |
|
2654 ###### `custom_fragment` |
|
2655 |
|
2656 Pass a string of custom configuration directives to be placed at the end of the directory configuration. |
|
2657 |
|
2658 ~~~ puppet |
|
2659 apache::vhost { 'monitor': |
|
2660 … |
|
2661 directories => [ |
|
2662 { |
|
2663 path => '/path/to/directory', |
|
2664 custom_fragment => ' |
|
2665 <Location /balancer-manager> |
|
2666 SetHandler balancer-manager |
|
2667 Order allow,deny |
|
2668 Allow from all |
|
2669 </Location> |
|
2670 <Location /server-status> |
|
2671 SetHandler server-status |
|
2672 Order allow,deny |
|
2673 Allow from all |
|
2674 </Location> |
|
2675 ProxyStatus On', |
|
2676 }, |
|
2677 ] |
|
2678 } |
|
2679 ~~~ |
|
2680 |
|
2681 ###### `deny` |
|
2682 |
|
2683 Sets a [Deny](http://httpd.apache.org/docs/2.2/mod/mod_authz_host.html#deny) directive, specifying which hosts are denied access to the server. **Deprecated:** This parameter is being deprecated due to a change in Apache. It only works with Apache 2.2 and lower. You can use it as a single string for one rule or as an array for more than one. |
|
2684 |
|
2685 ~~~ puppet |
|
2686 apache::vhost { 'sample.example.net': |
|
2687 docroot => '/path/to/directory', |
|
2688 directories => [ |
|
2689 { path => '/path/to/directory', |
|
2690 deny => 'from example.org', |
|
2691 }, |
|
2692 ], |
|
2693 } |
|
2694 ~~~ |
|
2695 |
|
2696 ###### `error_documents` |
|
2697 |
|
2698 An array of hashes used to override the [ErrorDocument](https://httpd.apache.org/docs/current/mod/core.html#errordocument) settings for the directory. |
|
2699 |
|
2700 ~~~ puppet |
|
2701 apache::vhost { 'sample.example.net': |
|
2702 directories => [ |
|
2703 { path => '/srv/www', |
|
2704 error_documents => [ |
|
2705 { 'error_code' => '503', |
|
2706 'document' => '/service-unavail', |
|
2707 }, |
|
2708 ], |
|
2709 }, |
|
2710 ], |
|
2711 } |
|
2712 ~~~ |
|
2713 |
|
2714 ###### `ext_filter_options` |
|
2715 |
|
2716 Sets the [ExtFilterOptions](https://httpd.apache.org/docs/current/mod/mod_ext_filter.html) directive. |
|
2717 Note that you must declare `class { 'apache::mod::ext_filter': }` before using this directive. |
|
2718 |
|
2719 ~~~ puppet |
|
2720 apache::vhost { 'filter.example.org': |
|
2721 docroot => '/var/www/filter', |
|
2722 directories => [ |
|
2723 { path => '/var/www/filter', |
|
2724 ext_filter_options => 'LogStderr Onfail=abort', |
|
2725 }, |
|
2726 ], |
|
2727 } |
|
2728 ~~~ |
|
2729 |
|
2730 ###### `geoip_enable` |
|
2731 |
|
2732 Sets the [GeoIPEnable](http://dev.maxmind.com/geoip/legacy/mod_geoip2/#Configuration) directive. |
|
2733 Note that you must declare `class {'apache::mod::geoip': }` before using this directive. |
|
2734 |
|
2735 ~~~ puppet |
|
2736 apache::vhost { 'first.example.com': |
|
2737 docroot => '/var/www/first', |
|
2738 directories => [ |
|
2739 { path => '/var/www/first', |
|
2740 geoip_enable => true, |
|
2741 }, |
|
2742 ], |
|
2743 } |
|
2744 ~~~ |
|
2745 |
|
2746 ###### `headers` |
|
2747 |
|
2748 Adds lines for [Header](http://httpd.apache.org/docs/current/mod/mod_headers.html#header) directives. |
|
2749 |
|
2750 ~~~ puppet |
|
2751 apache::vhost { 'sample.example.net': |
|
2752 docroot => '/path/to/directory', |
|
2753 directories => { |
|
2754 path => '/path/to/directory', |
|
2755 headers => 'Set X-Robots-Tag "noindex, noarchive, nosnippet"', |
|
2756 }, |
|
2757 } |
|
2758 ~~~ |
|
2759 |
|
2760 ###### `index_options` |
|
2761 |
|
2762 Allows configuration settings for [directory indexing](http://httpd.apache.org/docs/current/mod/mod_autoindex.html#indexoptions). |
|
2763 |
|
2764 ~~~ puppet |
|
2765 apache::vhost { 'sample.example.net': |
|
2766 docroot => '/path/to/directory', |
|
2767 directories => [ |
|
2768 { path => '/path/to/directory', |
|
2769 directoryindex => 'disabled', # this is needed on Apache 2.4 or mod_autoindex doesn't work |
|
2770 options => ['Indexes','FollowSymLinks','MultiViews'], |
|
2771 index_options => ['IgnoreCase', 'FancyIndexing', 'FoldersFirst', 'NameWidth=*', 'DescriptionWidth=*', 'SuppressHTMLPreamble'], |
|
2772 }, |
|
2773 ], |
|
2774 } |
|
2775 ~~~ |
|
2776 |
|
2777 ###### `index_order_default` |
|
2778 |
|
2779 Sets the [default ordering](https://httpd.apache.org/docs/current/mod/mod_autoindex.html#indexorderdefault) of the directory index. |
|
2780 |
|
2781 ~~~ puppet |
|
2782 apache::vhost { 'sample.example.net': |
|
2783 docroot => '/path/to/directory', |
|
2784 directories => [ |
|
2785 { path => '/path/to/directory', |
|
2786 order => 'Allow,Deny', |
|
2787 index_order_default => ['Descending', 'Date'], |
|
2788 }, |
|
2789 ], |
|
2790 } |
|
2791 ~~~ |
|
2792 |
|
2793 ###### `index_style_sheet` |
|
2794 |
|
2795 Sets the [IndexStyleSheet](https://httpd.apache.org/docs/current/mod/mod_autoindex.html#indexstylesheet), which adds a CSS stylesheet to the directory index. |
|
2796 |
|
2797 ~~~ puppet |
|
2798 apache::vhost { 'sample.example.net': |
|
2799 docroot => '/path/to/directory', |
|
2800 directories => [ |
|
2801 { path => '/path/to/directory', |
|
2802 options => ['Indexes','FollowSymLinks','MultiViews'], |
|
2803 index_options => ['FancyIndexing'], |
|
2804 index_style_sheet => '/styles/style.css', |
|
2805 }, |
|
2806 ], |
|
2807 } |
|
2808 ~~~ |
|
2809 |
|
2810 ###### `mellon_enable` |
|
2811 |
|
2812 Sets the [MellonEnable][`mod_auth_mellon`] directory to enable [`mod_auth_melon`][]. You can use [`apache::mod::auth_mellon`][] to install `mod_auth_mellon`. |
|
2813 |
|
2814 ~~~ puppet |
|
2815 apache::vhost { 'sample.example.net': |
|
2816 docroot => '/path/to/directory', |
|
2817 directories => [ |
|
2818 { path => '/', |
|
2819 provider => 'directory', |
|
2820 mellon_enable => 'info', |
|
2821 mellon_sp_private_key_file => '/etc/certs/${::fqdn}.key, |
|
2822 mellon_endpoint_path => '/mellon', |
|
2823 mellon_set_env_no_prefix => { 'ADFS_GROUP' => 'http://schemas.xmlsoap.org/claims/Group', |
|
2824 'ADFS_EMAIL' => 'http://schemas.xmlsoap.org/claims/EmailAddress', }, |
|
2825 mellon_user => 'ADFS_LOGIN', |
|
2826 }, |
|
2827 { path => '/protected', |
|
2828 provider => 'location', |
|
2829 mellon_enable => 'auth', |
|
2830 auth_type => 'Mellon', |
|
2831 auth_require => 'valid-user', |
|
2832 mellon_cond => ['ADFS_LOGIN userA [MAP]','ADFS_LOGIN userB [MAP]'], |
|
2833 }, |
|
2834 ] |
|
2835 } |
|
2836 ~~~ |
|
2837 |
|
2838 Related parameters follow the names of `mod_auth_melon` directives: |
|
2839 |
|
2840 - `mellon_cond`: Takes an array of mellon conditions that must be met to grant access, and creates a [MellonCond][`mod_auth_melon`] directive for each item in the array. |
|
2841 - `mellon_endpoint_path`: Sets the [MellonEndpointPath][`mod_auth_melon`] to set the mellon endpoint path. |
|
2842 - `mellon_idp_metadata_file`: Sets the [MellonIDPMetadataFile][`mod_auth_melon`] location of the IDP metadata file. |
|
2843 - `mellon_saml_rsponse_dump`: Sets the [MellonSamlResponseDump][`mod_auth_melon`] directive to enable debug of SAML. |
|
2844 - `mellon_set_env_no_prefix`: Sets the [MellonSetEnvNoPrefix][`mod_auth_melon`] directive to a hash of attribute names to map |
|
2845 to environment variables. |
|
2846 - `mellon_sp_private_key_file`: Sets the [MellonSPPrivateKeyFile][`mod_auth_melon`] directive for the private key location of the service provider. |
|
2847 - `mellon_sp_cert_file`: Sets the [MellonSPCertFile][`mod_auth_melon`] directive for the public key location of the service provider. |
|
2848 - `mellon_user`: Sets the [MellonUser][`mod_auth_melon`] attribute to use for the username. |
|
2849 |
|
2850 ###### `options` |
|
2851 |
|
2852 Lists the [Options](https://httpd.apache.org/docs/current/mod/core.html#options) for the given Directory block. |
|
2853 |
|
2854 ~~~ puppet |
|
2855 apache::vhost { 'sample.example.net': |
|
2856 docroot => '/path/to/directory', |
|
2857 directories => [ |
|
2858 { path => '/path/to/directory', |
|
2859 options => ['Indexes','FollowSymLinks','MultiViews'], |
|
2860 }, |
|
2861 ], |
|
2862 } |
|
2863 ~~~ |
|
2864 |
|
2865 ###### `order` |
|
2866 |
|
2867 Sets the order of processing Allow and Deny statements as per [Apache core documentation](http://httpd.apache.org/docs/2.2/mod/mod_authz_host.html#order). **Deprecated:** This parameter is being deprecated due to a change in Apache. It only works with Apache 2.2 and lower. |
|
2868 |
|
2869 ~~~ puppet |
|
2870 apache::vhost { 'sample.example.net': |
|
2871 docroot => '/path/to/directory', |
|
2872 directories => [ |
|
2873 { path => '/path/to/directory', |
|
2874 order => 'Allow,Deny', |
|
2875 }, |
|
2876 ], |
|
2877 } |
|
2878 ~~~ |
|
2879 |
|
2880 ###### `passenger_enabled` |
|
2881 |
|
2882 Sets the value for the [PassengerEnabled](http://www.modrails.com/documentation/Users%20guide%20Apache.html#PassengerEnabled) directive to 'on' or 'off'. Requires `apache::mod::passenger` to be included. |
|
2883 |
|
2884 ~~~ puppet |
|
2885 apache::vhost { 'sample.example.net': |
|
2886 docroot => '/path/to/directory', |
|
2887 directories => [ |
|
2888 { path => '/path/to/directory', |
|
2889 passenger_enabled => 'on', |
|
2890 }, |
|
2891 ], |
|
2892 } |
|
2893 ~~~ |
|
2894 |
|
2895 **Note:** There is an [issue](http://www.conandalton.net/2010/06/passengerenabled-off-not-working.html) using the PassengerEnabled directive with the PassengerHighPerformance directive. |
|
2896 |
|
2897 ###### `php_value` and `php_flag` |
|
2898 |
|
2899 `php_value` sets the value of the directory, and `php_flag` uses a boolean to configure the directory. Further information can be found [here](http://php.net/manual/en/configuration.changes.php). |
|
2900 |
|
2901 ###### `php_admin_value` and `php_admin_flag` |
|
2902 |
|
2903 `php_admin_value` sets the value of the directory, and `php_admin_flag` uses a boolean to configure the directory. Further information can be found [here](http://php.net/manual/en/configuration.changes.php). |
|
2904 |
|
2905 |
|
2906 ###### `satisfy` |
|
2907 |
|
2908 Sets a `Satisfy` directive per the [Apache Core documentation](http://httpd.apache.org/docs/2.2/mod/core.html#satisfy). **Deprecated:** This parameter is deprecated due to a change in Apache and only works with Apache 2.2 and lower. |
|
2909 |
|
2910 ~~~ puppet |
|
2911 apache::vhost { 'sample.example.net': |
|
2912 docroot => '/path/to/directory', |
|
2913 directories => [ |
|
2914 { path => '/path/to/directory', |
|
2915 satisfy => 'Any', |
|
2916 } |
|
2917 ], |
|
2918 } |
|
2919 ~~~ |
|
2920 |
|
2921 ###### `sethandler` |
|
2922 |
|
2923 Sets a `SetHandler` directive per the [Apache Core documentation](http://httpd.apache.org/docs/2.2/mod/core.html#sethandler). |
|
2924 |
|
2925 ~~~ puppet |
|
2926 apache::vhost { 'sample.example.net': |
|
2927 docroot => '/path/to/directory', |
|
2928 directories => [ |
|
2929 { path => '/path/to/directory', |
|
2930 sethandler => 'None', |
|
2931 } |
|
2932 ], |
|
2933 } |
|
2934 ~~~ |
|
2935 |
|
2936 ###### `set_output_filter` |
|
2937 |
|
2938 Sets a `SetOutputFilter` directive per the [Apache Core documentation](http://httpd.apache.org/docs/current/mod/core.html#setoutputfilter). |
|
2939 |
|
2940 ~~~ puppet |
|
2941 apache::vhost{ 'filter.example.net': |
|
2942 docroot => '/path/to/directory', |
|
2943 directories => [ |
|
2944 { path => '/path/to/directory', |
|
2945 set_output_filter => puppetdb-strip-resource-params, |
|
2946 }, |
|
2947 ], |
|
2948 } |
|
2949 ~~~ |
|
2950 |
|
2951 ###### `rewrites` |
|
2952 |
|
2953 Creates URL [`rewrites`](#rewrites) rules in vhost directories. Expects an array of hashes, and the hash keys can be any of 'comment', 'rewrite_base', 'rewrite_cond', or 'rewrite_rule'. |
|
2954 |
|
2955 ~~~ puppet |
|
2956 apache::vhost { 'secure.example.net': |
|
2957 docroot => '/path/to/directory', |
|
2958 directories => [ |
|
2959 { path => '/path/to/directory', |
|
2960 rewrites => [ { comment => 'Permalink Rewrites', |
|
2961 rewrite_base => '/' |
|
2962 }, |
|
2963 { rewrite_rule => [ '^index\.php$ - [L]' ] |
|
2964 }, |
|
2965 { rewrite_cond => [ '%{REQUEST_FILENAME} !-f', |
|
2966 '%{REQUEST_FILENAME} !-d', |
|
2967 ], |
|
2968 rewrite_rule => [ '. /index.php [L]' ], |
|
2969 } |
|
2970 ], |
|
2971 }, |
|
2972 ], |
|
2973 } |
|
2974 ~~~ |
|
2975 |
|
2976 ***Note**: If you include rewrites in your directories, also include `apache::mod::rewrite` and consider setting the rewrites using the `rewrites` parameter in `apache::vhost` rather than setting the rewrites in the vhost directories. |
|
2977 |
|
2978 ###### `shib_request_setting` |
|
2979 |
|
2980 Allows a valid content setting to be set or altered for the application request. This command takes two parameters: the name of the content setting, and the value to set it to. Check the Shibboleth [content setting documentation](https://wiki.shibboleth.net/confluence/display/SHIB2/NativeSPContentSettings) for valid settings. This key is disabled if `apache::mod::shib` is not defined. Check the [`mod_shib` documentation](https://wiki.shibboleth.net/confluence/display/SHIB2/NativeSPApacheConfig#NativeSPApacheConfig-Server/VirtualHostOptions) for more details. |
|
2981 |
|
2982 ~~~ puppet |
|
2983 apache::vhost { 'secure.example.net': |
|
2984 docroot => '/path/to/directory', |
|
2985 directories => [ |
|
2986 { path => '/path/to/directory', |
|
2987 shib_request_settings => { 'requiresession' => 'On' }, |
|
2988 shib_use_headers => 'On', |
|
2989 }, |
|
2990 ], |
|
2991 } |
|
2992 ~~~ |
|
2993 |
|
2994 ###### `shib_use_headers` |
|
2995 |
|
2996 When set to 'On', this turns on the use of request headers to publish attributes to applications. Valid values for this key is 'On' or 'Off', and the default value is 'Off'. This key is disabled if `apache::mod::shib` is not defined. Check the [`mod_shib` documentation](https://wiki.shibboleth.net/confluence/display/SHIB2/NativeSPApacheConfig#NativeSPApacheConfig-Server/VirtualHostOptions) for more details. |
|
2997 |
|
2998 ###### `ssl_options` |
|
2999 |
|
3000 String or list of [SSLOptions](https://httpd.apache.org/docs/current/mod/mod_ssl.html#ssloptions), which configure SSL engine run-time options. This handler takes precedence over SSLOptions set in the parent block of the vhost. |
|
3001 |
|
3002 ~~~ puppet |
|
3003 apache::vhost { 'secure.example.net': |
|
3004 docroot => '/path/to/directory', |
|
3005 directories => [ |
|
3006 { path => '/path/to/directory', |
|
3007 ssl_options => '+ExportCertData', |
|
3008 }, |
|
3009 { path => '/path/to/different/dir', |
|
3010 ssl_options => [ '-StdEnvVars', '+ExportCertData'], |
|
3011 }, |
|
3012 ], |
|
3013 } |
|
3014 ~~~ |
|
3015 |
|
3016 ###### `suphp` |
|
3017 |
|
3018 A hash containing the 'user' and 'group' keys for the [suPHP_UserGroup](http://www.suphp.org/DocumentationView.html?file=apache/CONFIG) setting. It must be used with `suphp_engine => on` in the vhost declaration, and can only be passed within `directories`. |
|
3019 |
|
3020 ~~~ puppet |
|
3021 apache::vhost { 'secure.example.net': |
|
3022 docroot => '/path/to/directory', |
|
3023 directories => [ |
|
3024 { path => '/path/to/directory', |
|
3025 suphp => { |
|
3026 user => 'myappuser', |
|
3027 group => 'myappgroup', |
|
3028 }, |
|
3029 }, |
|
3030 ], |
|
3031 } |
|
3032 ~~~ |
|
3033 |
|
3034 #### SSL parameters for `apache::vhost` |
|
3035 |
|
3036 All of the SSL parameters for `::vhost` default to whatever is set in the base `apache` class. Use the below parameters to tweak individual SSL settings for specific vhosts. |
|
3037 |
|
3038 ##### `ssl` |
|
3039 |
|
3040 Enables SSL for the virtual host. SSL vhosts only respond to HTTPS queries. Valid values are 'true' or 'false'. Defaults to 'false'. |
|
3041 |
|
3042 ##### `ssl_ca` |
|
3043 |
|
3044 Specifies the SSL certificate authority. Defaults to 'undef'. |
|
3045 |
|
3046 ##### `ssl_cert` |
|
3047 |
|
3048 Specifies the SSL certification. Defaults are based on your OS: '/etc/pki/tls/certs/localhost.crt' for RedHat, '/etc/ssl/certs/ssl-cert-snakeoil.pem' for Debian, '/usr/local/etc/apache22/server.crt' for FreeBSD, and '/etc/ssl/apache2/server.crt' on Gentoo. |
|
3049 |
|
3050 ##### `ssl_protocol` |
|
3051 |
|
3052 Specifies [SSLProtocol](http://httpd.apache.org/docs/current/mod/mod_ssl.html#sslprotocol). Expects an array or space separated string of accepted protocols. Defaults to 'all', '-SSLv2', '-SSLv3'. |
|
3053 |
|
3054 ##### `ssl_cipher` |
|
3055 |
|
3056 Specifies [SSLCipherSuite](http://httpd.apache.org/docs/current/mod/mod_ssl.html#sslciphersuite). Defaults to 'HIGH:MEDIUM:!aNULL:!MD5'. |
|
3057 |
|
3058 ##### `ssl_honorcipherorder` |
|
3059 |
|
3060 Sets [SSLHonorCipherOrder](http://httpd.apache.org/docs/current/mod/mod_ssl.html#sslhonorcipherorder), which is used to prefer the server's cipher preference order. Defaults to 'On' in the base `apache` config. |
|
3061 |
|
3062 ##### `ssl_certs_dir` |
|
3063 |
|
3064 Specifies the location of the SSL certification directory. Defaults to '/etc/ssl/certs' on Debian, '/etc/pki/tls/certs' on RedHat, '/usr/local/etc/apache22' on FreeBSD, and '/etc/ssl/apache2' on Gentoo. |
|
3065 |
|
3066 ##### `ssl_chain` |
|
3067 |
|
3068 Specifies the SSL chain. Defaults to 'undef'. (This default works out of the box, but it must be updated in the base `apache` class with your specific certificate information before being used in production.) |
|
3069 |
|
3070 ##### `ssl_crl` |
|
3071 |
|
3072 Specifies the certificate revocation list to use. Defaults to 'undef'. (This default works out of the box but must be updated in the base `apache` class with your specific certificate information before being used in production.) |
|
3073 |
|
3074 ##### `ssl_crl_path` |
|
3075 |
|
3076 Specifies the location of the certificate revocation list. Defaults to 'undef'. (This default works out of the box but must be updated in the base `apache` class with your specific certificate information before being used in production.) |
|
3077 |
|
3078 ##### `ssl_crl_check` |
|
3079 |
|
3080 Sets the certificate revocation check level via the [SSLCARevocationCheck directive](http://httpd.apache.org/docs/current/mod/mod_ssl.html#sslcarevocationcheck), defaults to 'undef'. This default works out of the box but must be specified when using CRLs in production. Only applicable to Apache 2.4 or higher; the value is ignored on older versions. |
|
3081 |
|
3082 ##### `ssl_key` |
|
3083 |
|
3084 Specifies the SSL key. Defaults are based on your operating system: '/etc/pki/tls/private/localhost.key' for RedHat, '/etc/ssl/private/ssl-cert-snakeoil.key' for Debian, '/usr/local/etc/apache22/server.key' for FreeBSD, and '/etc/ssl/apache2/server.key' on Gentoo. (This default works out of the box but must be updated in the base `apache` class with your specific certificate information before being used in production.) |
|
3085 |
|
3086 ##### `ssl_verify_client` |
|
3087 |
|
3088 Sets the [SSLVerifyClient](http://httpd.apache.org/docs/current/mod/mod_ssl.html#sslverifyclient) directive, which sets the certificate verification level for client authentication. Valid values are: 'none', 'optional', 'require', and 'optional_no_ca'. Defaults to 'undef'. |
|
3089 |
|
3090 ~~~ puppet |
|
3091 apache::vhost { 'sample.example.net': |
|
3092 … |
|
3093 ssl_verify_client => 'optional', |
|
3094 } |
|
3095 ~~~ |
|
3096 |
|
3097 ##### `ssl_verify_depth` |
|
3098 |
|
3099 Sets the [SSLVerifyDepth](http://httpd.apache.org/docs/current/mod/mod_ssl.html#sslverifydepth) directive, which specifies the maximum depth of CA certificates in client certificate verification. Defaults to 'undef'. |
|
3100 |
|
3101 ~~~ puppet |
|
3102 apache::vhost { 'sample.example.net': |
|
3103 … |
|
3104 ssl_verify_depth => 1, |
|
3105 } |
|
3106 ~~~ |
|
3107 |
|
3108 ##### `ssl_proxy_machine_cert` |
|
3109 |
|
3110 Sets the [SSLProxyMachineCertificateFile](http://httpd.apache.org/docs/current/mod/mod_ssl.html#sslproxymachinecertificatefile) directive, which specifies an all-in-one file where you keep the certs and keys used for this server to authenticate itself to remote servers. This file should be a concatenation of the PEM-encoded certificate files in order of preference. Defaults to 'undef'. |
|
3111 |
|
3112 ~~~ puppet |
|
3113 apache::vhost { 'sample.example.net': |
|
3114 … |
|
3115 ssl_proxy_machine_cert => '/etc/httpd/ssl/client_certificate.pem', |
|
3116 } |
|
3117 ~~~ |
|
3118 |
|
3119 ##### `ssl_options` |
|
3120 |
|
3121 Sets the [SSLOptions](http://httpd.apache.org/docs/current/mod/mod_ssl.html#ssloptions) directive, which configures various SSL engine run-time options. This is the global setting for the given vhost and can be a string or an array. Defaults to 'undef'. |
|
3122 |
|
3123 A string: |
|
3124 |
|
3125 ~~~ puppet |
|
3126 apache::vhost { 'sample.example.net': |
|
3127 … |
|
3128 ssl_options => '+ExportCertData', |
|
3129 } |
|
3130 ~~~ |
|
3131 |
|
3132 An array: |
|
3133 |
|
3134 ~~~ puppet |
|
3135 apache::vhost { 'sample.example.net': |
|
3136 … |
|
3137 ssl_options => [ '+StrictRequire', '+ExportCertData' ], |
|
3138 } |
|
3139 ~~~ |
|
3140 |
|
3141 ##### `ssl_openssl_conf_cmd` |
|
3142 |
|
3143 Sets the [SSLOpenSSLConfCmd](http://httpd.apache.org/docs/current/mod/mod_ssl.html#sslopensslconfcmd) directive, which provides direct configuration of OpenSSL parameters. Defaults to 'undef'. |
|
3144 |
|
3145 ##### `ssl_proxyengine` |
|
3146 |
|
3147 Specifies whether or not to use [SSLProxyEngine](http://httpd.apache.org/docs/current/mod/mod_ssl.html#sslproxyengine). Valid values are 'true' and 'false'. Defaults to 'false'. |
|
3148 |
|
3149 ####Define: FastCGI Server |
|
3150 |
|
3151 This type is intended for use with mod_fastcgi. It allows you to define one or more external FastCGI servers to handle specific file types. |
|
3152 |
|
3153 Ex: |
|
3154 |
|
3155 ~~~ puppet |
|
3156 apache::fastcgi::server { 'php': |
|
3157 host => '127.0.0.1:9000', |
|
3158 timeout => 15, |
|
3159 flush => false, |
|
3160 faux_path => '/var/www/php.fcgi', |
|
3161 fcgi_alias => '/php.fcgi', |
|
3162 file_type => 'application/x-httpd-php' |
|
3163 } |
|
3164 ~~~ |
|
3165 |
|
3166 Within your virtual host, you can then configure the specified file type to be handled by the fastcgi server specified above. |
|
3167 |
|
3168 ~~~ puppet |
|
3169 apache::vhost { 'www': |
|
3170 ... |
|
3171 custom_fragment => 'AddType application/x-httpd-php .php' |
|
3172 ... |
|
3173 } |
|
3174 ~~~ |
|
3175 |
|
3176 ##### `host` |
|
3177 |
|
3178 The hostname or IP address and TCP port number (1-65535) of the FastCGI server. |
|
3179 |
|
3180 ##### `timeout` |
|
3181 |
|
3182 The number of seconds of FastCGI application inactivity allowed before the request is aborted and the event is logged (at the error LogLevel). The inactivity timer applies only as long as a connection is pending with the FastCGI application. If a request is queued to an application, but the application doesn't respond (by writing and flushing) within this period, the request is aborted. If communication is complete with the application but incomplete with the client (the response is buffered), the timeout does not apply. |
|
3183 |
|
3184 ##### `flush` |
|
3185 |
|
3186 Force a write to the client as data is received from the application. By default, mod_fastcgi buffers data in order to free the application as quickly as possible. |
|
3187 |
|
3188 ##### `faux_path` |
|
3189 |
|
3190 `faux_path` does not have to exist in the local filesystem. URIs that Apache resolves to this filename are handled by this external FastCGI application. |
|
3191 |
|
3192 ##### `alias` |
|
3193 |
|
3194 A unique alias. This is used internally to link the action with the FastCGI server. |
|
3195 |
|
3196 ##### `file_type` |
|
3197 |
|
3198 The MIME-type of the file to be processed by the FastCGI server. |
|
3199 |
|
3200 ### Private Defines |
|
3201 |
|
3202 #### Define: `apache::peruser::multiplexer` |
|
3203 |
|
3204 This define checks if an Apache module has a class. If it does, it includes that class. If it does not, it passes the module name to the [`apache::mod`][] define. |
|
3205 |
|
3206 #### Define: `apache::peruser::multiplexer` |
|
3207 |
|
3208 Enables the [`Peruser`][] module for FreeBSD only. |
|
3209 |
|
3210 #### Define: `apache::peruser::processor` |
|
3211 |
|
3212 Enables the [`Peruser`][] module for FreeBSD only. |
|
3213 |
|
3214 #### Define: `apache::security::file_link` |
|
3215 |
|
3216 Links the `activated_rules` from [`apache::mod::security`][] to the respective CRS rules on disk. |
|
3217 |
|
3218 ### Templates |
|
3219 |
|
3220 The Apache module relies heavily on templates to enable the [`apache::vhost`][] and [`apache::mod`][] defines. These templates are built based on [Facter][] facts specific to your operating system. Unless explicitly called out, most templates are not meant for configuration. |
|
3221 |
|
3222 ## Limitations |
|
3223 |
|
3224 ### Ubuntu 10.04 |
|
3225 |
|
3226 The [`apache::vhost::WSGIImportScript`][] parameter creates a statement inside the virtual host that is unsupported on older versions of Apache, causing it to fail. This will be remedied in a future refactoring. |
|
3227 |
|
3228 ### RHEL/CentOS 5 |
|
3229 |
|
3230 The [`apache::mod::passenger`][] and [`apache::mod::proxy_html`][] classes are untested since repositories are missing compatible packages. |
|
3231 |
|
3232 ### RHEL/CentOS 6 |
|
3233 |
|
3234 The [`apache::mod::passenger`][] class is not installing as the the EL6 repository is missing compatible packages. |
|
3235 |
|
3236 ### RHEL/CentOS 7 |
|
3237 |
|
3238 The [`apache::mod::passenger`][] class is untested as the EL7 repository is missing compatible packages, which also blocks us from testing the [`apache::vhost`][] define's [`rack_base_uris`][] parameter. |
|
3239 |
|
3240 ### General |
|
3241 |
|
3242 This module is CI tested against both [open source Puppet][] and [Puppet Enterprise][] on: |
|
3243 |
|
3244 - CentOS 5 and 6 |
|
3245 - Ubuntu 12.04 and 14.04 |
|
3246 - Debian 7 |
|
3247 - RHEL 5, 6, and 7 |
|
3248 |
|
3249 This module also provides functions for other distributions and operating systems, such as FreeBSD, Gentoo, and Amazon Linux, but is not formally tested on them and are subject to regressions. |
|
3250 |
|
3251 ### SELinux and custom paths |
|
3252 |
|
3253 If [SELinux][] is in [enforcing mode][] and you want to use custom paths for `logroot`, `mod_dir`, `vhost_dir`, and `docroot`, you need to manage the files' context yourself. |
|
3254 |
|
3255 You can do this with Puppet: |
|
3256 |
|
3257 ~~~ puppet |
|
3258 exec { 'set_apache_defaults': |
|
3259 command => 'semanage fcontext -a -t httpd_sys_content_t "/custom/path(/.*)?"', |
|
3260 path => '/bin:/usr/bin/:/sbin:/usr/sbin', |
|
3261 require => Package['policycoreutils-python'], |
|
3262 } |
|
3263 |
|
3264 package { 'policycoreutils-python': |
|
3265 ensure => installed, |
|
3266 } |
|
3267 |
|
3268 exec { 'restorecon_apache': |
|
3269 command => 'restorecon -Rv /apache_spec', |
|
3270 path => '/bin:/usr/bin/:/sbin:/usr/sbin', |
|
3271 before => Class['Apache::Service'], |
|
3272 require => Class['apache'], |
|
3273 } |
|
3274 |
|
3275 class { 'apache': } |
|
3276 |
|
3277 host { 'test.server': |
|
3278 ip => '127.0.0.1', |
|
3279 } |
|
3280 |
|
3281 file { '/custom/path': |
|
3282 ensure => directory, |
|
3283 } |
|
3284 |
|
3285 file { '/custom/path/include': |
|
3286 ensure => present, |
|
3287 content => '#additional_includes', |
|
3288 } |
|
3289 |
|
3290 apache::vhost { 'test.server': |
|
3291 docroot => '/custom/path', |
|
3292 additional_includes => '/custom/path/include', |
|
3293 } |
|
3294 ~~~ |
|
3295 |
|
3296 You need to set the contexts using `semanage fcontext` instead of `chcon` because Puppet's `file` resources reset the values' context in the database if the resource doesn't specify it. |
|
3297 |
|
3298 ### FreeBSD |
|
3299 |
|
3300 In order to use this module on FreeBSD, you _must_ use apache24-2.4.12 (www/apache24) or newer. |
|
3301 |
|
3302 ## Development |
|
3303 |
|
3304 ### Contributing |
|
3305 |
|
3306 [Puppet Labs][] modules on the [Puppet Forge][] are open projects, and community contributions are essential for keeping them great. We can’t access the huge number of platforms and myriad hardware, software, and deployment configurations that Puppet is intended to serve. |
|
3307 |
|
3308 We want to make it as easy as possible to contribute changes so our modules work in your environment, but we also need contributors to follow a few guidelines to help us maintain and improve the modules' quality. |
|
3309 |
|
3310 For more information, please read the complete [module contribution guide][]. |
|
3311 |
|
3312 ### Running tests |
|
3313 |
|
3314 This project contains tests for both [rspec-puppet][] and [beaker-rspec][] to verify functionality. For detailed information on using these tools, please see their respective documentation. |
|
3315 |
|
3316 #### Testing quickstart: Ruby > 1.8.7 |
|
3317 |
|
3318 ~~~ |
|
3319 gem install bundler |
|
3320 bundle install |
|
3321 bundle exec rake spec |
|
3322 bundle exec rspec spec/acceptance |
|
3323 RS_DEBUG=yes bundle exec rspec spec/acceptance |
|
3324 ~~~ |
|
3325 |
|
3326 #### Testing quickstart: Ruby = 1.8.7 |
|
3327 |
|
3328 ~~~ |
|
3329 gem install bundler |
|
3330 bundle install --without system_tests |
|
3331 bundle exec rake spec |
|
3332 ~~~ |