diff --git a/modules/openstack_project/manifests/static.pp b/modules/openstack_project/manifests/static.pp index 1abff6198f..896c86d991 100644 --- a/modules/openstack_project/manifests/static.pp +++ b/modules/openstack_project/manifests/static.pp @@ -233,11 +233,12 @@ class openstack_project::static ( # Trystack ::httpd::vhost { 'trystack.openstack.org': - port => 80, - priority => '50', - docroot => '/opt/trystack', - template => 'openstack_project/trystack.vhost.erb', - require => Vcsrepo['/opt/trystack'], + port => 80, + priority => '50', + docroot => '/opt/trystack', + template => 'openstack_project/trystack.vhost.erb', + serveraliases => ['trystack.org'], + require => Vcsrepo['/opt/trystack'], } vcsrepo { '/opt/trystack': diff --git a/modules/openstack_project/templates/trystack.vhost.erb b/modules/openstack_project/templates/trystack.vhost.erb index f9e09793f4..3af5caaa89 100644 --- a/modules/openstack_project/templates/trystack.vhost.erb +++ b/modules/openstack_project/templates/trystack.vhost.erb @@ -5,6 +5,16 @@ NameVirtualHost <%= @vhost_name %>:<%= @port %> :<%= @port %>> ServerName <%= @srvname %> +<% if @serveraliases.is_a? Array -%> +<% @serveraliases.each do |name| -%><%= " ServerAlias #{name}\n" %><% end -%> +<% elsif @serveraliases != '' -%> +<%= " ServerAlias #{@serveraliases}" %> +<% end -%> + + # NOTE(pabelanger): Rewrite any valid serveraliases to srvname. + RewriteEngine On + RewriteCond %{HTTP_HOST} !<%= @srvname %>$ [NC] + RewriteRule ^/(.*)$ http://<%= @srvname %>/$1 [L,R=301] DocumentRoot <%= @docroot %> > @@ -12,6 +22,7 @@ NameVirtualHost <%= @vhost_name %>:<%= @port %> AllowOverride None Order allow,deny allow from all + Satisfy Any ErrorLog /var/log/apache2/<%= @name %>_error.log