Commit 0975ffb2bd0a959835c1dc89ebffd834021733e9
1 parent
408c6f31
Bump to v0.4.1. Add attribute for listen options.
Showing
5 changed files
with
13 additions
and
3 deletions
... | ... | @@ -46,8 +46,11 @@ default['cfe-nginx-php-fpm']['nginx']['sites'] = [ |
46 | 46 | |
47 | 47 | # Port number. Default: either '443' or '80', |
48 | 48 | # depending on whether HTTPS is used or not. |
49 | + # Listen options can be provided as string. If using HTTPS, | |
50 | + # the string 'ssl' will be automatically added as an option. | |
49 | 51 | # |
50 | 52 | #:port => nil, |
53 | + #:listen_opts => nil, | |
51 | 54 | |
52 | 55 | # Server aliases in an array. Default: [] |
53 | 56 | # | ... | ... |
... | ... | @@ -4,7 +4,7 @@ maintainer_email 'sysadmin@chromedia.com' |
4 | 4 | license 'Apache License' |
5 | 5 | description 'Simplifies setup of Nginx+PHP-FPM in Chromedia.' |
6 | 6 | long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) |
7 | -version '0.4.0' | |
7 | +version '0.4.1' | |
8 | 8 | |
9 | 9 | { |
10 | 10 | 'openssl' => '4.4.0', | ... | ... |
... | ... | @@ -56,6 +56,7 @@ node[cb]['nginx']['sites'].each do |site| |
56 | 56 | # Assign default values to attributes |
57 | 57 | site_index = site[:index] |
58 | 58 | site_port = site[:port] |
59 | + site_lopts = site[:listen_opts] | |
59 | 60 | site_aliases = site[:aliases] || [] |
60 | 61 | site_doc_root = site[:doc_root] |
61 | 62 | site_alo = site[:access_log_options] |
... | ... | @@ -240,6 +241,7 @@ node[cb]['nginx']['sites'].each do |site| |
240 | 241 | variables( |
241 | 242 | :server_name => site_sname, |
242 | 243 | :port => site_port, |
244 | + :listen_opts => site_lopts, | |
243 | 245 | :aliases => site_aliases, |
244 | 246 | :doc_root => site_doc_root, |
245 | 247 | :index => site_index, | ... | ... |
... | ... | @@ -30,6 +30,7 @@ upstream <%= us[:name] %> { |
30 | 30 | } |
31 | 31 | |
32 | 32 | <% end -%> |
33 | +<% lopts = @listen_opts ? " #{@listen_opts}" : '' -%> | |
33 | 34 | <% ## -%> |
34 | 35 | <% ## Server block for default nameless server -%> |
35 | 36 | <% ## -%> |
... | ... | @@ -64,7 +65,7 @@ server { |
64 | 65 | } |
65 | 66 | |
66 | 67 | server { |
67 | - listen <%= @port || '443' %> ssl; | |
68 | + listen <%= @port || '443' %> ssl<%= lopts %>; | |
68 | 69 | |
69 | 70 | ssl_certificate <%= @path_crt %>; |
70 | 71 | ssl_certificate_key <%= @path_key %>; |
... | ... | @@ -90,7 +91,7 @@ server { |
90 | 91 | add_header Strict-Transport-Security "<%= hsts %>"; |
91 | 92 | <% else -%> |
92 | 93 | server { |
93 | - listen <%= @port || '80' %>; | |
94 | + listen <%= @port || '80' %><%= lopts %>; | |
94 | 95 | |
95 | 96 | <% end -%> |
96 | 97 | <% @add_headers.each do |header, value| -%> | ... | ... |