Showing
3 changed files
with
18 additions
and
2 deletions
... | ... | @@ -64,6 +64,9 @@ node[cb]['nginx']['sites'].each do |site| |
64 | 64 | site_ss1 = site[:server_statements_1] || [] |
65 | 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 | 70 | site_logrobots = site.has_key?(:log_robots) ? site[:log_robots] : false |
68 | 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 | 249 | :log_robots => site_logrobots, |
247 | 250 | :log_hidden => site_loghidden, |
248 | 251 | |
252 | + :block_robots => site_bl_robots, | |
253 | + :block_fav => site_bl_fav, | |
254 | + | |
249 | 255 | :path_crt => path_crt, |
250 | 256 | :path_key => path_key, |
251 | 257 | :path_pass => path_pass, | ... | ... |
... | ... | @@ -120,19 +120,23 @@ server { |
120 | 120 | access_log <%= @log_dir %>/<%= @server_name %>.access.log<% if @access_log_options %> <%= @access_log_options %><% end %>; |
121 | 121 | error_log <%= @log_dir %>/<%= @server_name %>.error.log; |
122 | 122 | |
123 | +<% if @block_fav -%> | |
123 | 124 | location = /favicon.ico { |
124 | 125 | log_not_found off; |
125 | 126 | access_log off; |
126 | 127 | } |
127 | 128 | |
129 | +<% end -%> | |
130 | +<% if @block_robots -%> | |
128 | 131 | location = /robots.txt { |
129 | 132 | allow all; |
130 | -<% unless @log_robots -%> | |
133 | +<% unless @log_robots -%> | |
131 | 134 | log_not_found off; |
132 | 135 | access_log off; |
133 | -<% end -%> | |
136 | +<% end -%> | |
134 | 137 | } |
135 | 138 | |
139 | +<% end -%> | |
136 | 140 | # Deny all attempts to access hidden files and folders |
137 | 141 | location ~ (^|/)\. { |
138 | 142 | deny all; | ... | ... |