<% if @ssl %>
server {
  listen          80;
  server_name     <%= @server_name %>;

  return          301 https://$server_name$request_uri;
}
<% end %>

server {
  <% if @ssl %>
    <%= scope.function_template(['hdo/nginx-ssl-conf.erb']) %>
  <% else %>
    listen       80;
  <% end %>

  server_name    <%= @server_name %>;
  root           <%= @site_root %>;
  autoindex      off;

  <% if @restrict %>
    location ~ ^/(google.+\.html|robots\.txt) {  }

    location / {
      auth_basic 'Restricted';
      auth_basic_user_file /opt/nginx/.htpasswd;
    }
  <% end %>
}

<% if @ssl %>
server {
  listen          80;
  server_name     <%= @server_name %>;

  return          301 https://$server_name$request_uri;
}
<% end %>

server {
  <% if @ssl %>
    <%= scope.function_template(['hdo/nginx-ssl-conf.erb']) %>
  <% else %>
    listen       80;
  <% end %>

  server_name    <%= @server_name %>;
  root           <%= @site_root %>;
  autoindex      off;

  access_log  /opt/nginx/logs/<%= @server_name %>.access.log combined;
  error_log   /opt/nginx/logs/<%= @server_name %>.error.log;

  <% if @restrict %>
    location ~ ^/(google.+\.html|robots\.txt) {  }

    location / {
      auth_basic 'Restricted';
      auth_basic_user_file /opt/nginx/.htpasswd;
    }
  <% end %>
}

Fix separate logs for static sites
Fix separate logs for static sites
