Apache Listen directive in static site
Need to add possibility to bind on certain host
and port for virtual sites of type static, moreover
Listen directive should be added only to sites which
are in 'enable' state
Change-Id: I5be20123d4ef26efe5a9573ae10ba7348dfef694
diff --git a/apache/files/static.conf b/apache/files/static.conf
index 88b48d5..b852204 100644
--- a/apache/files/static.conf
+++ b/apache/files/static.conf
@@ -4,7 +4,8 @@
{%- else %}
{%- set root = '/srv/static/sites/'+site.name %}
{%- endif %}
-<VirtualHost *:{% if site.host.port is defined %}{{ site.host.port }}{% else %}{% if site.ssl is defined %}443{% else %}80{% endif %}{% endif %}>
+Listen {% if site.host.address is defined %}{{ site.host.address }}{% else %}0.0.0.0{% endif %}:{% if site.host.port is defined %}{{ site.host.port }}{% else %}{% if site.ssl is defined %}443{% else %}80{% endif %}{% endif %}
+<VirtualHost {% if site.host.address is defined %}{{ site.host.address }}{% else %}*{% endif %}:{% if site.host.port is defined %}{{ site.host.port }}{% else %}{% if site.ssl is defined %}443{% else %}80{% endif %}{% endif %}>
{%- include "apache/files/_name.conf" %}
{%- include "apache/files/_ssl.conf" %}
{%- include "apache/files/_log.conf" %}
diff --git a/apache/map.jinja b/apache/map.jinja
index 5ebdf9f..ab062ec 100644
--- a/apache/map.jinja
+++ b/apache/map.jinja
@@ -102,7 +102,7 @@
{# TODO: move away from managing listen in ports.conf, instead add this directive #}
{# to specific service config. Currently it conflits with horizon formula, that manage #}
{# port.conf by theirown, it leads to races when applying horizon/apache states. #}
-{%- if site.get('type', '') not in ['wsgi', 'proxy'] %}
+{%- if site.get('type', '') not in ['wsgi', 'proxy', 'static'] %}
{%- if site.host.get('port', 80) %}
{%- do listen_ports.update({site.host.get('port', 80): None}) %}
{%- endif %}