module-nginx/templates/vhost/vhost_ssl_footer.erb
2014-03-10 10:26:35 +01:00

37 lines
1.3 KiB
Text

<% if @include_files %><% @include_files.each do |file| -%>
include <%= file %>;
<% end -%><% end -%>
<% if @vhost_cfg_append -%><% @vhost_cfg_append.sort_by{ |k, v| k.to_s == 'allow' ? '' : k.to_s }.each do |key,value| -%>
<% if value.is_a?(Hash) -%><% value.each do |subkey,subvalue| -%>
<% Array(subkey).each do |asubkey| -%>
<% Array(subvalue).each do |asubvalue| -%>
<%= key %> <%= asubkey %> <%= asubvalue %>;
<% end -%>
<% end -%>
<% end -%><% else -%>
<% Array(value).each do |sub| -%>
<%= key %> <%= sub %>;
<% end -%>
<% end -%>
<% end -%><% end -%>
<% if @vhost_cfg_ssl_append -%><% @vhost_cfg_ssl_append.sort_by{ |k, v| k.to_s == 'allow' ? '' : k.to_s }.each do |key,value| -%>
<% if value.is_a?(Hash) -%><% value.each do |subkey,subvalue| -%>
<% Array(subkey).each do |asubkey| -%>
<% Array(subvalue).each do |asubvalue| -%>
<%= key %> <%= asubkey %> <%= asubvalue %>;
<% end -%>
<% end -%>
<% end -%><% else -%>
<% Array(value).each do |sub| -%>
<%= key %> <%= sub %>;
<% end -%>
<% end -%>
<% end -%><% end -%>
}
<% if @rewrite_www_to_non_www -%>
server {
listen <%= @listen_ip %>:<%= @ssl_port %> ssl;
server_name www.<%= @name.gsub(/^www\./, '') %>;
rewrite ^ https://<%= @name.gsub(/^www\./, '') %>$uri permanent;
}
<% end %>