Use first server name for non-www redirects to prevent issues with naming of vhosts within defined types.
Signed-off-by: Kalman Olah <kalman@inuits.eu>
This commit is contained in:
parent
400e58a505
commit
12d515f7f7
4 changed files with 6 additions and 6 deletions
|
@ -19,7 +19,7 @@ include <%= file %>;
|
|||
<% if @rewrite_www_to_non_www -%>
|
||||
server {
|
||||
listen <%= @listen_ip %>:<%= @listen_port %>;
|
||||
server_name www.<%= @name.gsub(/^www\./, '') %>;
|
||||
return 301 http://<%= @name.gsub(/^www\./, '') %>$uri;
|
||||
server_name www.<%= @server_name[0].gsub(/^www\./, '') %>;
|
||||
return 301 http://<%= @server_name[0].gsub(/^www\./, '') %>$uri;
|
||||
}
|
||||
<% end -%>
|
||||
|
|
|
@ -4,7 +4,7 @@ server {
|
|||
<% if @ipv6_enable && (defined? @ipaddress6) %>
|
||||
listen [<%= @ipv6_listen_ip %>]:<%= @ipv6_listen_port %> <% if @ipv6_listen_options %><%= @ipv6_listen_options %><% end %>;
|
||||
<% end %>
|
||||
server_name <%= @rewrite_www_to_non_www ? @name.gsub(/^www\./, '') : @server_name.join(" ") %>;
|
||||
server_name <%= @rewrite_www_to_non_www ? @server_name[0].gsub(/^www\./, '') : @server_name.join(" ") %>;
|
||||
<% if defined? @auth_basic -%>
|
||||
auth_basic "<%= @auth_basic %>";
|
||||
<% end -%>
|
||||
|
|
|
@ -27,7 +27,7 @@ include <%= file %>;
|
|||
<% if @rewrite_www_to_non_www -%>
|
||||
server {
|
||||
listen <%= @listen_ip %>:<%= @ssl_port %> ssl;
|
||||
server_name www.<%= @name.gsub(/^www\./, '') %>;
|
||||
return 301 https://<%= @name.gsub(/^www\./, '') %>$uri;
|
||||
server_name www.<%= @server_name[0].gsub(/^www\./, '') %>;
|
||||
return 301 https://<%= @server_name[0].gsub(/^www\./, '') %>$uri;
|
||||
}
|
||||
<% end %>
|
||||
|
|
|
@ -3,7 +3,7 @@ server {
|
|||
<% if @ipv6_enable && (defined? @ipaddress6) %>
|
||||
listen [<%= @ipv6_listen_ip %>]:<%= @ssl_port %> ssl<% if @spdy == 'on' %> spdy<% end %><% if @ipv6_listen_options %> <%= @ipv6_listen_options %><% end %>;
|
||||
<% end %>
|
||||
server_name <%= @rewrite_www_to_non_www ? @name.gsub(/^www\./, '') : @server_name.join(" ") %>;
|
||||
server_name <%= @rewrite_www_to_non_www ? @server_name[0].gsub(/^www\./, '') : @server_name.join(" ") %>;
|
||||
|
||||
ssl on;
|
||||
|
||||
|
|
Loading…
Reference in a new issue