Forge Home

nginx

Puppet module for nginx

14,234 downloads

4,692 latest version

4.6 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

  • 6.0.0 (latest)
  • 5.1.0
  • 5.0.1
  • 5.0.0
  • 4.0.0
  • 3.0.0
  • 2.0.0
  • 1.6.1
  • 1.6.0
  • 1.5.0
  • 1.4.0
  • 1.3.0
  • 1.2.0
  • 1.1.0
  • 1.0.0
released Jun 22nd 2017
This version is compatible with:
  • , , ,

Start using this module

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

Add this module to your Puppetfile:

mod 'aneesh-nginx', '2.0.0'
Learn more about managing modules with a Puppetfile

Add this module to your Bolt project:

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

Manually install this module globally with Puppet module tool:

puppet module install aneesh-nginx --version 2.0.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
Tags: web, proxy, nginx, http

Documentation

aneesh/nginx — version 2.0.0 Jun 22nd 2017

NGINX Module

Overview

This module install and configure nginx web server.

Usage

Default configuration:

include nginx

Change configuration file settings:

class { 'nginx':
    user                      => 'nginx',
    worker_processes          => 'auto',
    error_log                 => '/var/log/nginx/error.log',
    pid                       => '/run/nginx.pid',
    include                   => [ '/usr/share/nginx/modules/*.conf' ],
    worker_connections        => '1024',
    access_log                => '/var/log/nginx/access.log  main',
    sendfile                  => 'on',
    tcp_nopush                => 'on',
    tcp_nodelay               => 'on',
    keepalive_timeout         => '65',
    types_hash_max_size       => '2048',
    default_type              => 'application/octet-stream',
    http_include              => [ '/etc/nginx/mime.types', '/etc/nginx/conf.d/*.conf', '/etc/nginx/sites-enabled/*.conf' ],
    server_tokens             => 'off',
}

Create virtual server:

nginx::virtual_server { 'example.com.conf':
    file_name            => 'example.com.conf',
    listen               => [ '80' ],
    server_name          => 'example.com www.example.com',
    server_tokens        => 'off',
    access_log           => '/var/log/nginx/example.com-access.log',
    error_log            => '/var/log/nginx/example.com-error.log',
    error_page           => [ '404  /404.html', '500 502 503 504  /50x.html' ],
    client_max_body_size => '2M',
    location             => {
        '/'             => [
            'root  /var/www/example.com/public_html/',
            'index index.php  index.html index.htm',
        ],
        '~ \.php$'      => [
            'root          /var/www/example.com/public_html/',
            'fastcgi_pass  127.0.0.1:9000',
            'fastcgi_index index.php',
            'fastcgi_param SCRIPT_FILENAME   $document_root$fastcgi_script_name',
            'include       fastcgi_params',
        ],
        '= /404.html'   => [
            'root /usr/share/nginx/html',
        ],
        '= /50x.html'   => [
            'root /usr/share/nginx/html',
        ],
    },
}