Version information
This version is compatible with:
- Puppet Enterprise 2023.8.x, 2023.7.x, 2023.6.x, 2023.5.x, 2023.4.x, 2023.3.x, 2023.2.x, 2023.1.x, 2023.0.x, 2021.7.x, 2021.6.x, 2021.5.x, 2021.4.x, 2021.3.x, 2021.2.x, 2021.1.x, 2021.0.x, 2019.8.x, 2019.7.x, 2019.5.x, 2019.4.x, 2019.3.x, 2019.2.x, 2019.1.x, 2019.0.x, 2018.1.x, 2017.3.x, 2017.2.x, 2017.1.x, 2016.5.x, 2016.4.x
- Puppet >=2.7.20 <9.0.0
- ,
Start using this module
Add this module to your Puppetfile:
mod 'thias-nginx', '1.0.11'
Learn more about managing modules with a PuppetfileDocumentation
puppet-nginx
Overview
Install, enable and configure an NGINX web server instance with its main configuration file options as well as additional configuration snippets.
The module is very Red Hat Enterprise Linux focused, as the defaults try to change everything in ways which are typical for RHEL, but it also works on other distributions and is very easy to port if needed.
nginx
: Main class for the NGINX web server.nginx::file
: Manage additional configuration snippets.
Modules
Starting with nginx 1.10, there are now loadable modules available. The
modular
parameter is set to true
by default for Fedora 24+ and RHEL 8+
but may also be explicitly set on other releases when using 1.10+ packages.
The $modules
array is used to set modules to be installed and the
$modules_absent
array is used to set modules to be purged.
Examples
Modular nginx 1.10+ packages with two non-default modules installed :
class { '::nginx:'
modular => true,
modules => [ 'http-perl', 'stream' ],
}
Default server, with a typical minimal virtualhost and ready for PHP-FPM :
class { '::nginx':
# Fix for "upstream sent too big header ..." errors
fastcgi_buffers => '8 8k',
fastcgi_buffer_size => '8k',
upstream => {
fpmbackend => [
'server unix:/var/run/php-fpm-www.sock',
],
},
}
nginx::file { 'www.example.com.conf':
content => template('mymodule/www.example.com.conf.erb'),
}
# Use the included example FastCGI for PHP configuration
nginx::file { 'php.conf.inc':
source => 'puppet:///modules/nginx/php.conf.inc',
}
Sample configuration file mymodule/www.example.com.conf.erb
mentioned above :
# Main virtualhost
server {
listen 80;
server_name www.example.com;
root /var/www/www.example.com;
include /etc/nginx/conf.d/php.conf.inc;
#include /etc/nginx/conf.d/php-to-index.conf.inc
access_log /var/log/nginx/www.example.com-access.log main;
error_log /var/log/nginx/www.example.com-error.log;
}
If you intend to use a PHP framework where all non-existing requests must be
handled by /index.php
, then also install and include php-to-index.conf.inc
.
2024-04-11 - 1.0.11
- Fix README upstream example, fixes #11 (@jmetzger).
- Switch reload to use systemd.
2019-09-17 - 1.0.10
- Rebase mime.types to latest 1.16.1 version.
2016-06-14 - 1.0.9
- Add support for modular nginx 1.10+ packages.
- Add support for
file
in mainconfdir
instead ofconf.d
subdir. - Add facts to report nginx majversion, minversion and full version.
2016-02-02 - 1.0.8
- Add support for nginx::file ensure => absent.
2015-12-01 - 1.0.7
- Add support for multiple error_log by using an array.
2015-08-21 - 1.0.6
- Add more ssl_* parameters.
2015-04-28 - 1.0.5
- Add more ssl_* parameters.
- Make params values easy to override using hiera.
2015-04-01 - 1.0.4
- Add gzip_comp_level parameter.
2014-12-16 - 1.0.3
- Update mime.types with current nginx 1.6 content.
- Clean ups to make puppet lint happy.
2014-12-02 - 1.0.2
- Fix nginx.conf.erb upstream with recent puppet versions (#9).
2014-10-21 - 1.0.1
- Add SELinux support, RHEL 6.6 now targets nginx with httpd_t.
2014-09-09 - 1.0.0
- Revert worker_processes default value since 'auto' only works with 1.2+
- Add basic Debian and Ubuntu support (#3 @DavidGriffith, #8 @tomav).
- Add support for fastcgi_read_timeout.
2014-04-01 - 0.1.9
- Fix http_raw_lines (whurleyf1).
- Fix owner, group and mode of nginx::file resources.
2013-11-27 - 0.1.8
- Add support for gzip_proxied.
- Add support for worker_cpu_affinity.
- Change worker_processes default to 'auto', which makes most sense.
2013-11-21 - 0.1.7
- Follow recommendation of using try_files in php.conf.inc (jaysh).
- Make error_log configurable.
- Also include a useful php-to-index.conf.inc example.
- Add support for global ssl_certificate and ssl_certificate_key directives.
2013-10-14 - 0.1.6
- Fix README title line.
- Fix conf.d directory creation.
- Fix when changing default.conf (jaysh).
2013-05-20 - 0.1.5
- Use 2-space indent.
- Also use @-prefixed variables in mime.types.erb.
2012-12-18 - 0.1.4
- Add options for proxy and fastcgi buffers.
2012-09-19 - 0.1.3
- Update README and include mentioned example php.conf.inc file.
- Add mime_types hash to allow adding mime type extensions.
2012-07-17 - 0.1.2
- Fix markdown in the README.
- Move the service restart command to params, fix for Gentoo.
- Add support for specifying "upstream" as hashes.
- Add support for http_raw_lines for simple cases with no config snippet.
- Fix \n in the disabled default.conf.
2012-03-12 - 0.1.1
- Clean up the nginx module to match current puppetlabs guidelines.
- Rename the conf definition to file, to be consistent with apache_httpd::file.
- Add the params class to split out distro-specific parameters.
- Add simple smoke testing tests.
- Remove leftover listen_http and listen_https options.
Copyright (C) 2011-2015 Matthias Saou Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.