From d00a8988aa60652e94ed3289a66cb9bd5216c7d3 Mon Sep 17 00:00:00 2001 From: akarasik Date: Wed, 15 Mar 2017 10:38:28 +0200 Subject: [PATCH] Support multiple virtual hosts Fully implement the support of several apache host aliases, by adding one primary URL. This primary URL will be used in the server.xml, and now the virtual_host_alias can be really be an array. --- attributes/default.rb | 3 ++- templates/default/3.8+/server.xml.erb | 2 +- templates/default/bitbucket/server.xml.erb | 2 +- templates/default/server-tomcat7.xml.erb | 4 ++-- templates/default/server-tomcat8.xml.erb | 2 +- templates/default/server.xml.erb | 2 +- 6 files changed, 8 insertions(+), 7 deletions(-) diff --git a/attributes/default.rb b/attributes/default.rb index c4294a8..5692304 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -174,7 +174,8 @@ default['stash']['apache2']['access_log'] = '' default['stash']['apache2']['error_log'] = '' default['stash']['apache2']['port'] = 80 -default['stash']['apache2']['virtual_host_alias'] = node['fqdn'] +default['stash']['apache2']['virtual_host_primary'] = node['fqdn'] +default['stash']['apache2']['virtual_host_alias'] = node['stash']['apache2']['virtual_host_primary'] default['stash']['apache2']['virtual_host_name'] = node['hostname'] default['stash']['apache2']['ssl']['access_log'] = '' diff --git a/templates/default/3.8+/server.xml.erb b/templates/default/3.8+/server.xml.erb index dcc8f1a..c696f6b 100644 --- a/templates/default/3.8+/server.xml.erb +++ b/templates/default/3.8+/server.xml.erb @@ -81,7 +81,7 @@ redirectPort="<%= node['stash']['apache2']['ssl']['port'] %>" secure="true" scheme="https" - proxyName="<%= node['stash']['apache2']['virtual_host_alias'] %>" + proxyName="<%= node['stash']['apache2']['virtual_host_primary'] %>" proxyPort="<%= node['stash']['apache2']['ssl']['port'] %>" <% else -%> redirectPort="<%= node['stash']['tomcat']['ssl_port'] %>" diff --git a/templates/default/bitbucket/server.xml.erb b/templates/default/bitbucket/server.xml.erb index a09d84c..3a63769 100644 --- a/templates/default/bitbucket/server.xml.erb +++ b/templates/default/bitbucket/server.xml.erb @@ -81,7 +81,7 @@ redirectPort="<%= node['stash']['apache2']['ssl']['port'] %>" secure="true" scheme="https" - proxyName="<%= node['stash']['apache2']['virtual_host_alias'] %>" + proxyName="<%= node['stash']['apache2']['virtual_host_primary'] %>" proxyPort="<%= node['stash']['apache2']['ssl']['port'] %>" <% else -%> redirectPort="<%= node['stash']['tomcat']['ssl_port'] %>" diff --git a/templates/default/server-tomcat7.xml.erb b/templates/default/server-tomcat7.xml.erb index 4a139de..2624e59 100644 --- a/templates/default/server-tomcat7.xml.erb +++ b/templates/default/server-tomcat7.xml.erb @@ -83,7 +83,7 @@ redirectPort="<%= node['stash']['apache2']['ssl']['port'] %>" secure="true" scheme="https" - proxyName="<%= node['stash']['apache2']['virtual_host_alias'] %>" + proxyName="<%= node['stash']['apache2']['virtual_host_primary'] %>" proxyPort="<%= node['stash']['apache2']['ssl']['port'] %>" <% else -%> redirectPort="<%= node['stash']['tomcat']['ssl_port'] %>" @@ -193,4 +193,4 @@ - \ No newline at end of file + diff --git a/templates/default/server-tomcat8.xml.erb b/templates/default/server-tomcat8.xml.erb index 69c26d3..9b9e66a 100644 --- a/templates/default/server-tomcat8.xml.erb +++ b/templates/default/server-tomcat8.xml.erb @@ -81,7 +81,7 @@ redirectPort="<%= node['stash']['apache2']['ssl']['port'] %>" secure="true" scheme="https" - proxyName="<%= node['stash']['apache2']['virtual_host_alias'] %>" + proxyName="<%= node['stash']['apache2']['virtual_host_primary'] %>" proxyPort="<%= node['stash']['apache2']['ssl']['port'] %>" <% else -%> redirectPort="<%= node['stash']['tomcat']['ssl_port'] %>" diff --git a/templates/default/server.xml.erb b/templates/default/server.xml.erb index bc9a79c..6983a7e 100644 --- a/templates/default/server.xml.erb +++ b/templates/default/server.xml.erb @@ -76,7 +76,7 @@ compressableMimeType="text/html,text/xml,text/plain,text/css,application/json,application/javascript,application/x-javascript" secure="true" scheme="https" - proxyName="<%= node['stash']['apache2']['virtual_host_alias'] %>" + proxyName="<%= node['stash']['apache2']['virtual_host_primary'] %>" proxyPort="<%= node['stash']['apache2']['ssl']['port'] %>" redirectPort="<%= node['stash']['apache2']['ssl']['port'] %>" />