cookbook-openstack-dashboard/templates/default/dash-site.erb
gengjh 2697810589 Support customize the dashboard http/https port
We need support to customize the OpenStack dashboard http and https
listen port to avoid these ports conflict with existing web application.

Change-Id: I9a3464487e0c8eb2eed397e847a9e4a6fedd43e0
2014-01-17 10:12:09 +08:00

72 lines
2.9 KiB
Plaintext

<%= node["openstack"]["dashboard"]["custom_template_banner"] %>
<% unless node['apache']['listen_ports'].map(&:to_i).uniq.include?(node['openstack']['dashboard']['http_port'].to_i) %>
Listen *:<%= node['openstack']['dashboard']['http_port'].to_i%>
NameVirtualHost *:<%= node['openstack']['dashboard']['http_port'].to_i%>
<% end -%>
<VirtualHost *:<%= node['openstack']['dashboard']['http_port'] %>>
<% if node["openstack"]["dashboard"]["server_hostname"] -%>
ServerName <%= node["openstack"]["dashboard"]["server_hostname"] %>
<% end -%>
<% if node["openstack"]["dashboard"]["use_ssl"] %>
RewriteEngine On
RewriteCond %{HTTPS} off
<% if node['openstack']['dashboard']['http_port'].to_i != 80 or node['openstack']['dashboard']['https_port'].to_i != 443 %>
RewriteRule ^(.*)$ https://%{SERVER_NAME}:<%= node['openstack']['dashboard']['https_port'] %>%{REQUEST_URI} [L,R]
<% else -%>
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R]
<% end -%>
</VirtualHost>
<% unless node['apache']['listen_ports'].map(&:to_i).uniq.include?(node['openstack']['dashboard']['https_port'].to_i) %>
Listen *:<%= node['openstack']['dashboard']['https_port'].to_i%>
NameVirtualHost *:<%= node['openstack']['dashboard']['https_port'].to_i%>
<% end -%>
<VirtualHost *:<%= node['openstack']['dashboard']['https_port'] %>>
<% if node["openstack"]["dashboard"]["server_hostname"] -%>
ServerName <%= node["openstack"]["dashboard"]["server_hostname"] %>
<% end -%>
<% end %>
ServerAdmin <%= node["apache"]["contact"] %>
WSGIScriptAlias / <%= node["openstack"]["dashboard"]["wsgi_path"] %>
WSGIDaemonProcess dashboard user=<%= node["apache"]["user"] %> group=<%= node["apache"]["group"] %> processes=3 threads=10 python-path=<%= node["openstack"]["dashboard"]["dash_path"] %>
WSGIProcessGroup dashboard
DocumentRoot <%= node["openstack"]["dashboard"]["dash_path"] %>/.blackhole/
Alias /static <%= node["openstack"]["dashboard"]["static_path"] %>
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory <%= node["openstack"]["dashboard"]["dash_path"] %>>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
<Directory <%= node["openstack"]["dashboard"]["static_path"] %>>
Options FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
<% if node["openstack"]["dashboard"]["use_ssl"] %>
SSLEngine on
SSLCertificateFile <%= @ssl_cert_file %>
SSLCertificateKeyFile <%= @ssl_key_file %>
<% end %>
# Allow custom files to overlay the site (such as logo.png)
RewriteEngine On
RewriteCond /opt/dash/site_overlay%{REQUEST_FILENAME} -s
RewriteRule ^/(.+) /opt/dash/site_overlay/$1 [L]
ErrorLog <%= node["apache"]["log_dir"] %>/<%= node["openstack"]["dashboard"]["error_log"] %>
LogLevel warn
CustomLog <%= node["apache"]["log_dir"] %>/<%= node["openstack"]["dashboard"]["access_log"] %> combined
</VirtualHost>