Forge Home

openresty

Nginx openresty

8,532 downloads

8,365 latest version

1.5 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

  • 0.1.1 (latest)
  • 0.1.0
released Apr 22nd 2016

Start using this module

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

Add this module to your Puppetfile:

mod 'smartins-openresty', '0.1.1'
Learn more about managing modules with a Puppetfile

Add this module to your Bolt project:

bolt module add smartins-openresty
Learn more about using this module with an existing project

Manually install this module globally with Puppet module tool:

puppet module install smartins-openresty --version 0.1.1

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

smartins/openresty — version 0.1.1 Apr 22nd 2016

puppet-openresty

A puppet module to handle openresty configuration and installation

Usage

Basic

include openresty

Upstream

  openresty::upstream {"phpfastcgi":
    ensure  => present,
    members => [
                '127.0.0.1:9000',
                ],
    notify => Service['openresty'],
  }

Advanced Site

  openresty::site {"mywebsite.io":
    ensure => enable,
    listen_port => '80',
    gzip => 'yes',
    server_name => ["mywebsite.io"],
    ssl => 'no',
    log_access => "/space/log/access.log",
    log_error => "/space/log/error.log",
    root => "/space/mywebsite/public/",
    locations => {
      '~ \.php$' => {
        'root' => "/space/mywebsite/public/",
        "include" => "/usr/local/openresty/nginx/conf/fastcgi.conf",
        'custom_params' => {
          "access_log" => "/space/log/upstream.log  upstream",
          "fastcgi_pass" => "phpfastcgi",
        }
      },
      '/' => {
        'root' => "/space/mywebsite/public/",
        "need_auth" => "true",
        "auth_basic" => "authentication",
        "auth_basic_user_file" => "/space/auth.conf",
        'index' => "index.php",
        'custom_params' => {
          "try_files" => '$uri $uri/ /index.php$is_args$args',
          "satisfy" => "any",
          "access_by_lua" => "'
                          local uri = ngx.var.request_uri
                          local redis = require \"resty.redis\"
                          local red = redis:new()

                          red:set_timeout(1000)

                          local ok, err = red:connect(\"127.0.0.1\", 6379)
                          if not ok then
                              ngx.log(ngx.ERR, \"Failed to connect to Redis: \", err)
                              return ngx.exit(500)
                          end
                      '",
        }
      },
    },
    require => [File["/space/mywebsite"]],
  }