# Generated by Chef
<% if File.exist?(@ssl_cert) && File.exist?(@ssl_key) -%>
server {
  listen 443 ssl http2;
  add_header Strict-Transport-Security "max-age=15768000";

  ssl_certificate <%= @ssl_cert %>;
  ssl_certificate_key <%= @ssl_key %>;

  server_name <%= @domain %>;

  access_log <%= node[:nginx][:log_dir] %>/<%= @domain %>.access.log json;
  error_log <%= node[:nginx][:log_dir] %>/<%= @domain %>.error.log warn;

  location / {
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_redirect off;
    proxy_pass http://localhost:<%= @port %>;
   }
}
<% end -%>
