2011-06-07 00:25:04 +02:00
|
|
|
server {
|
2013-07-17 20:42:57 +02:00
|
|
|
listen <%= @listen_ip %>:<%= @listen_port %><% if @listen_options %> <%= @listen_options %><% end %>;
|
2013-07-08 16:58:05 +02:00
|
|
|
<% # check to see if ipv6 support exists in the kernel before applying %>
|
2013-07-17 20:42:57 +02:00
|
|
|
<% if @ipv6_enable == 'true' && (defined? ipaddress6) %>
|
|
|
|
listen [<%= ipv6_listen_ip %>]:<%= @ipv6_listen_port %> <% if @ipv6_listen_options %><%= @ipv6_listen_options %><% end %> ipv6only=on;
|
2013-07-08 16:58:05 +02:00
|
|
|
<% end %>
|
2013-07-17 20:42:57 +02:00
|
|
|
server_name <%= @rewrite_www_to_non_www ? @name.gsub(/^www\./, '') : @server_name.join(" ") %>;
|
2013-07-08 16:58:05 +02:00
|
|
|
<% if defined? auth_basic -%>
|
2013-07-17 20:42:57 +02:00
|
|
|
auth_basic "<%= @auth_basic %>";
|
2013-07-08 16:58:05 +02:00
|
|
|
<% end -%>
|
|
|
|
<% if defined? auth_basic_user_file -%>
|
2013-07-17 20:42:57 +02:00
|
|
|
auth_basic_user_file <%= @auth_basic_user_file %>;
|
2013-07-08 16:58:05 +02:00
|
|
|
<% end -%>
|
2013-07-17 20:42:57 +02:00
|
|
|
<% @proxy_set_header.each do |header| -%>
|
2013-07-08 16:58:05 +02:00
|
|
|
proxy_set_header <%= header %>;
|
|
|
|
<% end -%>
|
|
|
|
<% if @rewrite_to_https -%>
|
2013-05-13 10:51:47 +02:00
|
|
|
if ($ssl_protocol = "") {
|
2013-07-08 21:06:02 +02:00
|
|
|
return 301 https://$host$request_uri;
|
2013-05-13 10:51:47 +02:00
|
|
|
}
|
2013-07-08 16:58:05 +02:00
|
|
|
<% end -%>
|
2013-07-31 23:07:59 +02:00
|
|
|
|
|
|
|
access_log <%= scope.lookupvar('nginx::params::nx_logdir')%>/<%= @name.gsub(' ', '_') %>.access.log;
|
|
|
|
error_log <%= scope.lookupvar('nginx::params::nx_logdir')%>/<%= @name.gsub(' ', '_') %>.error.log;
|
|
|
|
|