Forge Home

nginx

A Puppet module to install, configure and deploy the Nginx webserver.

8,135 downloads

5,997 latest version

3.3 quality score

Version information

  • 1.1.0 (latest)
  • 1.0.1
released Sep 9th 2016
This version is compatible with:
  • Puppet Enterprise 2017.2.x, 2017.1.x, 2016.5.x, 2016.4.x
  • Puppet >=4.0.0 <5.0.0
  • Debian

Start using this module

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

Add this module to your Puppetfile:

mod 'lostinmalloc-nginx', '1.1.0'
Learn more about managing modules with a Puppetfile

Add this module to your Bolt project:

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

Manually install this module globally with Puppet module tool:

puppet module install lostinmalloc-nginx --version 1.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.

Download

Documentation

lostinmalloc/nginx — version 1.1.0 Sep 9th 2016

lostinmalloc-nginx

Table of Contents

  1. Overview
  2. Module Description
  3. Setup
  4. Usage
  5. Reference
  6. Limitations
  7. Contact

Overview

The lostinmalloc-nginx module manages the Nginx web server. It does take care of its configuration and deployment on a node. Make sure to check the official webpage should you have any doubts about Nginx.

lostinmalloc-nginx is distributed through the Apache License 2.0. Please do refer to the LICENSE for details.

Module Description

The lostinmalloc-nginx module allows the client to install, configure and manage the Nginx web server. The package, nginx-full, is installed through the default package management tool, which is APT in the case of Linux Debian and its derivative. The client can configure several of its properties, so that it meets the needs of any specific node.

Note that, on the contrary of Apache, Nginx needs to be compiled from the source, should we need to add modules. The lostinmalloc-nginx module does not allow this, since it relies on the version available through the default packages provider of the system.

Despite this, should the client ever need to install additional dependencies, apart those required by Nginx itself, he can do so by specifying them as extra_dependencies. The lostinmalloc-nginx module will take care to install them. See the Reference for more details.

What lostinmalloc-nginx does

The lostinmalloc-nginx module is responsible of:

  • Installing Nginx. More specifically, it does install nginx-full.
  • Customizing the Nginx configuration.
  • Making sure that Apache is turned off, if present.

What lostinmalloc-nginx does not

The lostinmalloc-nginx module is not responsible of:

  • Providing virtual host configuration files. The client is responsible of placing them in the default /etc/nginx/sites-enabled/ directory.
  • Making sure any virtual host being server is properly configured.
  • Taking down the default virtual host installed with Nginx as an example. This is defined in /etc/nginx/sites-available/default and is soft linked into /etc/nginx/sites-enabled/.

Setup

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

$ sudo puppet module install lostinmalloc-nginx

Once installed, creating an instance of lostinmalloc-nginx on a node is a simple as:

node 'puppet.lostinmalloc.com' {
  class { 'nginx': }
}

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

Requirements

In terms of requirements lostinmalloc-nginx demands:

  • puppet >=4.0.0

Usage

As aforementioned, lostinmalloc-nginx expects all the data to be provided through Hiera. In the example below, we are going to set the following:

  • We are installing an extra dependency, cmatrix, through APT.
  • We are customizing Nginx so that:
    • It will accept upload files up to 15 MB.
    • Will store the pid in /var/run/nginx.pid.
    • Will be executed as the www-data user.
    • Will have 8 workers.
    • Each worker will handle up to 768 connections.
---
nginx::params::extra_dependencies:
  cmatrix: 'apt'
nginx::params::config:
  client_max_body_size: '15M'
  pid: '/var/run/nginx.pid'
  user: 'www-data'
  worker_connections: '768'
  worker_processes: '8'

Reference

Attributes written in italic, are optional:

  • extra_dependencies: a hash representing extra dependencies that the client wants to install. The information must be provided in the form package_name : provider. lostinmalloc-nginx takes care to merge both the mandatory and the extra dependencies into a unique hash and install any of the dependencies that are currently not present.

Limitations

lostinmalloc-nginx has been developed and tested on the following setup(s):

  • Operating Systems:
    • Debian 7 Wheezy (3.2.68-1+deb7u3 x86_64)
    • Debian 8 Jessie (3.16.7-ckt11-1+deb8u3 x86_64)
  • Puppet
    • 4.2.1
  • Hiera
    • 3.0.1
  • Facter
    • 2.4.4
  • Ruby
    • 2.1.6p336

Contact

You can contact me through:

Please feel free to report any bug and suggest new features/improvements.