File: server.pp

package info (click to toggle)
puppet-module-puppetlabs-apache 12.2.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,664 kB
  • sloc: ruby: 275; sh: 32; makefile: 2
file content (73 lines) | stat: -rw-r--r-- 2,734 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# @summary
#   Defines one or more external FastCGI servers to handle specific file types. Use this 
#   defined type with `mod_fastcgi`.
#
# @param host
#   Determines the FastCGI's hostname or IP address and TCP port number (1-65535).
#
# @param timeout
#   Sets the number of seconds a [FastCGI](http://www.fastcgi.com/) 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.
#
# @param flush
#   Forces `mod_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.
#
# @param faux_path
#   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.
#
# @param fcgi_alias
#   Internally links actions with the FastCGI server. This alias must be unique.
#
# @param file_type
#   Sets the MIME `content-type` of the file to be processed by the FastCGI server.
#
# @param pass_header
#   Sets a header for the server
#
define apache::fastcgi::server (
  String $host                    = '127.0.0.1:9000',
  Integer $timeout                = 15,
  Boolean $flush                  = false,
  Stdlib::Absolutepath $faux_path = "/var/www/${name}.fcgi",
  Stdlib::Unixpath $fcgi_alias    = "/${name}.fcgi",
  String $file_type               = 'application/x-httpd-php',
  Optional[String] $pass_header   = undef,
) {
  include apache::mod::fastcgi

  Apache::Mod['fastcgi'] -> Apache::Fastcgi::Server[$title]

  if $host =~ Stdlib::Absolutepath {
    $socket = $host
  }

  $parameters = {
    'timeout'     => $timeout,
    'flush'       => $flush,
    'socket'      => $socket,
    'host'        => $host,
    'pass_header' => $pass_header,
    'faux_path'   => $faux_path,
    'fcgi_alias'  => $fcgi_alias,
    'file_type'   => $file_type,
  }

  file { "fastcgi-pool-${name}.conf":
    ensure  => file,
    path    => "${apache::confd_dir}/fastcgi-pool-${name}.conf",
    owner   => 'root',
    group   => $apache::params::root_group,
    mode    => $apache::file_mode,
    content => epp('apache/fastcgi/server.epp', $parameters),
    require => Exec["mkdir ${apache::confd_dir}"],
    before  => File[$apache::confd_dir],
    notify  => Class['apache::service'],
  }
}