Forge Home

nginx

Puppet module for nginx

14,467 downloads

4,783 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.

Support the Puppet Community by contributing to this module

You are welcome to contribute to this module by suggesting new features, currency updates, or fixes. Every contribution is valuable to help ensure that the module remains compatible with the latest Puppet versions and continues to meet community needs. Complete the following steps:

  1. Review the module’s contribution guidelines and any licenses. Ensure that your planned contribution aligns with the author’s standards and any legal requirements.
  2. Fork the repository on GitHub, make changes on a branch of your fork, and submit a pull request. The pull request must clearly document your proposed change.

For questions about updating the module, contact the module’s author.

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 Oct 30th 2018
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', '6.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 6.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 6.0.0 Oct 30th 2018

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',
        ],
    },
}