<% if File.exist?(@ssl_cert) && File.exist?(@ssl_key) -%> # Generated by Chef server { listen <%= "#{node['openresty']['listen_ip']}:" if node['openresty']['listen_ip'] %>443 ssl http2; listen [::]:443 ssl http2; server_name <%= @domain %>; root /var/www/<%= @domain %>/site; access_log <%= node['openresty']['log_dir'] %>/<%= @domain %>.access.log; error_log <%= node['openresty']['log_dir'] %>/<%= @domain %>.error.log; gzip_static on; gzip_comp_level 5; add_header 'Access-Control-Allow-Origin' '*'; location ~* .(css)$ { expires 1d; } location ~* .(woff|woff2)$ { expires max; } ssl_certificate <%= @ssl_cert %>; ssl_certificate_key <%= @ssl_key %>; } <% end -%>