Forge Home


A Puppet module to install, configure and deploy the latest Nginx webserver from stable or mainline.


1,182 latest version

5.0 quality score

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

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

Version information

  • 4.1.0 (latest)
  • 4.0.0
  • 3.4.0
  • 3.3.0
  • 3.2.0
  • 3.1.0
  • 3.0.2
  • 3.0.1
  • 3.0.0
  • 2.1.1
  • 2.1.0
  • 2.0.4
  • 2.0.3
  • 2.0.2
  • 2.0.1
  • 2.0.0
  • 1.0.0
  • 0.4.0
  • 0.3.0
  • 0.2.0
  • 0.1.0
released May 8th 2021
This version is compatible with:
  • Puppet Enterprise 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
  • Puppet >= 5.5.10 < 8.0.0
  • , , , , , , , , ArchLinux
  • nginx

Start using this module

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

Add this module to your Puppetfile:

mod 'rehan-nginx', '4.1.0'
Learn more about managing modules with a Puppetfile

Add this module to your Bolt project:

bolt module add rehan-nginx
Learn more about using this module with an existing project

Manually install this module globally with Puppet module tool:

puppet module install rehan-nginx --version 4.1.0

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



rehan/nginx — version 4.1.0 May 8th 2021


Puppet Forge Build Status

Table of Contents

  1. Overview
  2. Module Description
  3. Setup
  4. Usage
  5. Dependencies
  6. Development


A Puppet module to install, configure and deploy the latest Nginx webserver from stable or mainline (development) branch.

Module Description

A puppet module for managing the installation and configuration of Nginx. This module installs and configures the nginx package and allows configuration of vhosts and the webproxy itself. The main objective of this module is to minimize changes to the default install of nginx package. It tries to give you maximum flexibility by providing vhost resource that can be used to provide a complete file.

Where possible, this module can be used to ensure the nginx installation is up to date with latest upstream release branches of nginx. Currently, this feature is supported for the following OSes:


In order to install rehan-nginx, run the following command:

$ puppet module install rehan-nginx

The module does expect all the data to be provided through 'Hiera'. See Usage for examples on how to configure it.


This module is designed to be as clean and compliant with latest puppet code guidelines.




A basic install with the defaults would be:

contain nginx

Or the PKI Server using the parameters:

class{ 'nginx':
  repo_manage          => true,
  repo_branch          => 'stable',
  package_ensure       => 'latest',
  package_name         => 'nginx',
  package_extras       => [],
  service_manage       => true,
  service_enable       => true,
  service_ensure       => 'running',
  service_name         => 'nginx',
  install_location     => '/etc/nginx',
  firewall_manage      => false,
  enabled_sites_manage => false,
  configs              => hiera_hash('nginx::configs', {}),
  vhosts               => hiera_hash('nginx::vhosts', {}),
  • repo_manage: Manage the upstream repository on supported OSes. The default value is true.
  • repo_branch: The upstream repo branch can be stable or mainline. The default value is stable.
  • package_ensure: Ensure the nginx package is installed. The default value is latest.
  • package_name: Nginx package name. The default is nginx.
  • package_extras: Any extra packages required along with nginx. The default is an empty array.
  • service_enable: Enables the nginx service at boot. The default is true.
  • service_ensure: Controls the nginx service. The default is running.
  • service_manage: Controls if this module should manage the nginx service. The default is true.
  • service_name: Nginx service name. The default is nginx.
  • install_location: The install location for nginx. The default is /etc/nginx.
  • firewall_manage: Manage the firewall for port 80 and 443 if puppetlabs-firewall module is used. The default is false.
  • enabled_sites_manage: If set to true, the /etc/nginx/sites-enabled will be purged and only managed vhosts will be maintained.
  • configs: The hash value for config files that will be dropped in /etc/nginx/conf.d. See nginx::resource::config for details.
  • vhosts: The hash value for virtual hosts files to be dropped in /etc/nginx/sites-available. See nginx::resource::vhost for details.

All of this data can be provided through Hiera.


nginx::repo_manage: true
nginx::repo_branch: 'stable'
nginx::package_ensure: 'latest'
nginx::package_name: 'nginx'
nginx::service_manage: true
nginx::service_enable: true
nginx::service_ensure: 'running'
nginx::service_name: 'nginx'
nginx::install_location: '/etc/nginx'
nginx::firewall_manage: false
nginx::enabled_sites_manage: false
    source: 'puppet:///modules/webproxy/logstash_format.conf'
    enabled: true
    source: 'puppet:///modules/webproxy/'

Note: The above config assumes that you have a module called webproxy with a files directoy containing the static files.



This resource allows creation of a configuration file under /etc/nginx/conf.d.


nginx::resource::config { 'logstash_format':
  source => 'puppet:///modules/webproxy/logstash_format.conf',
  • source a file in a puppet module.


This resource allows creation of a virtual host file under /etc/nginx/sites-available.


nginx::resource::vhost { '':
  enabled => true,
  source  => 'puppet:///modules/webproxy/',

or with a template:

nginx::resource::vhost { '':
  enabled => true,
  content => template('webproxy/example.erb'),
  • source a file in a puppet module. It is not possible to combine this option with content.
  • content Content of the vhost file. It is not possible to combine this option with source.
  • enabled Creates a link under /etc/nginx/sites-enabled.



You can submit pull requests and create issues through the official page of this module on GitHub. Please do report any bug and suggest new features/improvements.