Use Apache VirtualHost
Change-Id: I4ffe9ba1f3b9092044299e5cca55ce78dd6efbc5
diff --git a/horizon/files/openstack-dashboard.conf.Debian b/horizon/files/openstack-dashboard.conf.Debian
index 40942a2..5882391 100644
--- a/horizon/files/openstack-dashboard.conf.Debian
+++ b/horizon/files/openstack-dashboard.conf.Debian
@@ -1,27 +1,35 @@
{%- from "horizon/map.jinja" import server with context %}
-WSGIScriptAlias / /usr/share/openstack-dashboard/openstack_dashboard/wsgi/django.wsgi
-WSGIDaemonProcess horizon user=horizon group=horizon processes={{ server.wsgi.processes }} threads={{ server.wsgi.threads }}
-WSGIProcessGroup horizon
+<VirtualHost {{ server.get('bind', {}).get('address', '0.0.0.0') }}:{{ server.get('bind', {}).get('port', 80) }}>
+ ServerName {{ server.get('host', {}).get('name', 'openstack-dashboard') }}
-Alias /static /usr/share/openstack-dashboard/static
+ WSGIScriptAlias / /usr/share/openstack-dashboard/openstack_dashboard/wsgi/django.wsgi
+ WSGIDaemonProcess horizon user=horizon group=horizon processes={{ server.wsgi.processes }} threads={{ server.wsgi.threads }}
+ WSGIProcessGroup horizon
-<Directory /usr/share/openstack-dashboard/openstack_dashboard/wsgi>
- Order allow,deny
- Allow from all
-</Directory>
+ Alias /static /usr/share/openstack-dashboard/static
-<Directory /usr/share/openstack-dashboard/static>
- <IfModule mod_expires.c>
- ExpiresActive On
- ExpiresDefault "access 6 month"
- </IfModule>
- <IfModule mod_deflate.c>
- SetOutputFilter DEFLATE
- </IfModule>
+ <Directory /usr/share/openstack-dashboard/openstack_dashboard/wsgi>
+ Order allow,deny
+ Allow from all
+ </Directory>
- Require all granted
-</Directory>
+ <Directory /usr/share/openstack-dashboard/static>
+ <IfModule mod_expires.c>
+ ExpiresActive On
+ ExpiresDefault "access 6 month"
+ </IfModule>
+ <IfModule mod_deflate.c>
+ SetOutputFilter DEFLATE
+ </IfModule>
+
+ Require all granted
+ </Directory>
+ ServerSignature Off
+ ErrorLog "{{ server.apache_log_dir }}/{{ server.apache_log_filename }}_error.log"
+ CustomLog "{{ server.apache_log_dir }}/{{ server.apache_log_filename }}_access.log" combined
+
+</VirtualHost>
{% if server.get('ssl', {}).get('enabled', False) %}
@@ -51,6 +59,10 @@
Order allow,deny
Allow from all
</Directory>
+
+ ServerSignature Off
+ ErrorLog "{{ server.apache_log_dir }}/{{ server.apache_log_filename }}_ssl_error.log"
+ CustomLog "{{ server.apache_log_dir }}/{{ server.apache_log_filename }}_access_ssl.log" combined
</VirtualHost>
-{% endif %}
\ No newline at end of file
+{% endif %}
diff --git a/horizon/map.jinja b/horizon/map.jinja
index 761f378..b896fa1 100644
--- a/horizon/map.jinja
+++ b/horizon/map.jinja
@@ -9,6 +9,8 @@
'service': 'apache2',
'config': '/etc/openstack-dashboard/local_settings.py',
'apache_config': '/etc/apache2/conf-available/openstack-dashboard.conf',
+ 'apache_log_dir': '/var/log/apache2',
+ 'apache_log_filename': 'openstack_dashboard',
'certs_dir': '/etc/ssl/certs',
'private_dir': '/etc/ssl/private',
'port_config_file': '/etc/apache2/ports.conf',
@@ -25,6 +27,8 @@
'service': 'httpd',
'config': '/etc/openstack-dashboard/local_settings',
'apache_config': '/etc/httpd/conf.d/openstack-dashboard.conf',
+ 'apache_log_dir': '/var/log/httpd',
+ 'apache_log_filename': 'openstack_dashboard',
'certs_dir': '/etc/pki/tls/certs',
'private_dir': '/etc/pki/tls/private',
'port_config_file': '/etc/httpd/conf/httpd.conf',