Skip to content

Commit 34fd936

Browse files
author
Kelsey Hightower
committed
Merge pull request #1 from xaque208/proxy
add support for building an nginx proxy
2 parents 728e363 + eb47a23 commit 34fd936

File tree

6 files changed

+41
-5
lines changed

6 files changed

+41
-5
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Puppet-nginx
2+
3+
A puppet module to manage the nginx webserver.
4+

manifests/params.pp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@
5050
}
5151

5252
include ssl::params
53-
$default_ssl_path = $ssl::params::ssl_path
54-
$default_ssl_cert = $ssl::params::ssl_cert_file
55-
$default_ssl_key = $ssl::params::ssl_key_file
53+
$default_ssl_path = $ssl::params::ssl_path
54+
$default_ssl_cert = $ssl::params::ssl_cert_file
55+
$default_ssl_key = $ssl::params::ssl_key_file
5656

5757
}

manifests/server.pp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@
2222
include nginx
2323
include nginx::params
2424

25+
# We assume for our modules, we have the motd module, & use it.
26+
motd::register{ 'nginx': }
27+
2528
# Platform specific server setup items
2629
case $operatingsystem {
2730
'debian': { include nginx::server::debian }

manifests/vhost/proxy.pp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
$ssl_redirect = false,
4242
$magic = '',
4343
$isdefaultvhost = false,
44+
$proxy = true,
4445
) {
4546

4647
include nginx

templates/vhost/_listen.conf.erb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
listen [::]:<%= ssl_port %><%= " default ipv6only=on" if @isdefaultvhost %> ssl;
1919
<% end -%>
2020

21-
ssl_certificate <%= ssl_cert %>;
22-
ssl_certificate_key <%= ssl_key %>;
21+
ssl_certificate <%= ssl_path %>/<%= ssl_cert %>;
22+
ssl_certificate_key <%= ssl_path %>/<%= ssl_key %>;
2323
ssl_ciphers RC4:HIGH:!aNULL:!MD5; # use decent and non-crap ciphers.
2424
ssl_prefer_server_ciphers on;
2525
ssl_session_timeout 10m;

templates/vhost/_proxy.conf.erb

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<% if @proxy -%>
2+
location / {
3+
proxy_pass http://<%= name %>_proxy;
4+
<% if @ssl_redirect -%>
5+
proxy_redirect http:// https://;
6+
if ($scheme = 'http') {
7+
rewrite ^ https://$server_name$request_uri? permanent;
8+
}
9+
<% else -%>
10+
proxy_redirect off;
11+
<% end -%>
12+
proxy_set_header X-Real-IP $remote_addr;
13+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
14+
proxy_set_header Host $host;
15+
16+
client_max_body_size 10m;
17+
client_body_buffer_size 128k;
18+
19+
proxy_connect_timeout 90;
20+
proxy_send_timeout 90;
21+
proxy_read_timeout 90;
22+
23+
proxy_buffer_size 4k;
24+
proxy_buffers 4 32k;
25+
proxy_busy_buffers_size 64k;
26+
proxy_temp_file_write_size 64k;
27+
}
28+
<% end -%>

0 commit comments

Comments
 (0)