Commit 0975ffb2bd0a959835c1dc89ebffd834021733e9

Authored by Earth Ugat
1 parent 408c6f31

Bump to v0.4.1. Add attribute for listen options.

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