module-nginx/README.markdown

97 lines
1.9 KiB
Markdown
Raw Normal View History

2011-06-07 01:05:27 +02:00
# NGINX Module
2012-12-14 07:14:25 +01:00
James Fryman <james@frymanet.com>
2011-06-07 01:05:27 +02:00
This module manages NGINX from within Puppet.
# Quick Start
Install and bootstrap an NGINX instance
2011-06-30 19:37:12 +02:00
<pre>
2011-06-07 01:05:27 +02:00
node default {
class { 'nginx': }
}
2011-06-30 19:37:12 +02:00
</pre>
2011-06-07 01:05:27 +02:00
Setup a new virtual host
2011-06-30 19:37:12 +02:00
<pre>
2011-06-07 01:05:27 +02:00
node default {
2012-09-02 09:50:57 +02:00
class { 'nginx': }
2011-06-07 01:05:27 +02:00
nginx::resource::vhost { 'www.puppetlabs.com':
ensure => present,
www_root => '/var/www/www.puppetlabs.com',
}
}
2011-06-30 19:37:12 +02:00
</pre>
2011-06-07 01:05:27 +02:00
Add a Proxy Server(s)
2011-06-30 19:37:12 +02:00
<pre>
2011-06-07 01:05:27 +02:00
node default {
2012-09-02 09:50:57 +02:00
class { 'nginx': }
2012-03-04 18:19:44 +01:00
nginx::resource::upstream { 'puppet_rack_app':
ensure => present,
members => [
2011-06-07 01:05:27 +02:00
'localhost:3000',
'localhost:3001',
'localhost:3002',
],
}
2011-06-07 18:04:04 +02:00
2011-06-07 01:05:27 +02:00
nginx::resource::vhost { 'rack.puppetlabs.com':
ensure => present,
proxy => 'http://puppet_rack_app',
}
}
2011-06-30 19:37:12 +02:00
</pre>
Add an smtp proxy
<pre>
node default {
class { 'nginx':
mail => true,
}
nginx::resource::mailhost { 'domain1.example':
ensure => present,
auth_http => 'server2.example/cgi-bin/auth',
protocol => 'smtp',
listen_port => 587,
ssl_port => 465,
starttls => 'only',
xclient => 'off',
ssl => 'true',
ssl_cert => '/tmp/server.crt',
ssl_key => '/tmp/server.pem',
}
}
</pre>
# Hiera Support
Define the nginx resources in Hiera. Here are the examples:
<pre>
nginx::nginx_upstreams:
'puppet_rack_app':
ensure: present
members:
- localhost:3000
- localhost:3001
- localhost:3002
nginx::nginx_vhosts:
'www.puppetlabs.com':
www_root: '/var/www/www.puppetlabs.com'
'rack.puppetlabs.com':
ensure: present
proxy: 'http://puppet_rack_app'
nginx::nginx_locations:
'static':
location: '~ "^/static/[0-9a-fA-F]{8}\/(.*)$"'
vhost: www.puppetlabs.com
'userContent':
location: /userContent
vhost: www.puppetlabs.com
www_root: /var/www/html
</pre>
2013-08-18 23:26:38 +02:00