Showing
3 changed files
with
18 additions
and
2 deletions
1 | +# 0.3.7 | ||
2 | + | ||
3 | +Add site options :block_robots and :block_fav to indicate | ||
4 | +whether or not to create a location block for robots.txt and | ||
5 | +favicon.ico, respectively. | ||
6 | + | ||
1 | # 0.3.6 | 7 | # 0.3.6 |
2 | 8 | ||
3 | Expose an attribute to customize installed PHP extensions | 9 | Expose an attribute to customize installed PHP extensions |
@@ -64,6 +64,9 @@ node[cb]['nginx']['sites'].each do |site| | @@ -64,6 +64,9 @@ node[cb]['nginx']['sites'].each do |site| | ||
64 | site_ss1 = site[:server_statements_1] || [] | 64 | site_ss1 = site[:server_statements_1] || [] |
65 | site_ss2 = site[:server_statements_2] || [] | 65 | site_ss2 = site[:server_statements_2] || [] |
66 | 66 | ||
67 | + site_bl_robots = site.has_key?(:block_robots) ? site[:block_robots] : true | ||
68 | + site_bl_fav = site.has_key?(:block_fav) ? site[:block_fav] : true | ||
69 | + | ||
67 | site_logrobots = site.has_key?(:log_robots) ? site[:log_robots] : false | 70 | site_logrobots = site.has_key?(:log_robots) ? site[:log_robots] : false |
68 | site_loghidden = site.has_key?(:log_hidden) ? site[:log_hidden] : true | 71 | site_loghidden = site.has_key?(:log_hidden) ? site[:log_hidden] : true |
69 | 72 | ||
@@ -246,6 +249,9 @@ node[cb]['nginx']['sites'].each do |site| | @@ -246,6 +249,9 @@ node[cb]['nginx']['sites'].each do |site| | ||
246 | :log_robots => site_logrobots, | 249 | :log_robots => site_logrobots, |
247 | :log_hidden => site_loghidden, | 250 | :log_hidden => site_loghidden, |
248 | 251 | ||
252 | + :block_robots => site_bl_robots, | ||
253 | + :block_fav => site_bl_fav, | ||
254 | + | ||
249 | :path_crt => path_crt, | 255 | :path_crt => path_crt, |
250 | :path_key => path_key, | 256 | :path_key => path_key, |
251 | :path_pass => path_pass, | 257 | :path_pass => path_pass, |
@@ -120,19 +120,23 @@ server { | @@ -120,19 +120,23 @@ server { | ||
120 | access_log <%= @log_dir %>/<%= @server_name %>.access.log<% if @access_log_options %> <%= @access_log_options %><% end %>; | 120 | access_log <%= @log_dir %>/<%= @server_name %>.access.log<% if @access_log_options %> <%= @access_log_options %><% end %>; |
121 | error_log <%= @log_dir %>/<%= @server_name %>.error.log; | 121 | error_log <%= @log_dir %>/<%= @server_name %>.error.log; |
122 | 122 | ||
123 | +<% if @block_fav -%> | ||
123 | location = /favicon.ico { | 124 | location = /favicon.ico { |
124 | log_not_found off; | 125 | log_not_found off; |
125 | access_log off; | 126 | access_log off; |
126 | } | 127 | } |
127 | 128 | ||
129 | +<% end -%> | ||
130 | +<% if @block_robots -%> | ||
128 | location = /robots.txt { | 131 | location = /robots.txt { |
129 | allow all; | 132 | allow all; |
130 | -<% unless @log_robots -%> | 133 | +<% unless @log_robots -%> |
131 | log_not_found off; | 134 | log_not_found off; |
132 | access_log off; | 135 | access_log off; |
133 | -<% end -%> | 136 | +<% end -%> |
134 | } | 137 | } |
135 | 138 | ||
139 | +<% end -%> | ||
136 | # Deny all attempts to access hidden files and folders | 140 | # Deny all attempts to access hidden files and folders |
137 | location ~ (^|/)\. { | 141 | location ~ (^|/)\. { |
138 | deny all; | 142 | deny all; |