|
|
|
|
|
|
|
|
{# Define default values here so the template below can just focus on layout #} |
|
|
{# Define default values here so the template below can just focus on layout #} |
|
|
{% from "apache/map.jinja" import apache with context %} |
|
|
|
|
|
{% set sitename = site.get('ServerName', id) %} |
|
|
|
|
|
|
|
|
{%- from "apache/map.jinja" import apache with context -%} |
|
|
|
|
|
{%- set sitename = site.get('ServerName', id) -%} |
|
|
|
|
|
|
|
|
{% set vals = { |
|
|
|
|
|
|
|
|
{%- set vals = { |
|
|
'interfaces': site.get('interface', '*').split(), |
|
|
'interfaces': site.get('interface', '*').split(), |
|
|
'port': site.get('port', '80'), |
|
|
'port': site.get('port', '80'), |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
'DirectoryIndex': site.get('DirectoryIndex'), |
|
|
'DirectoryIndex': site.get('DirectoryIndex'), |
|
|
'UseCanonicalName': site.get('UseCanonicalName'), |
|
|
'UseCanonicalName': site.get('UseCanonicalName'), |
|
|
'AllowEncodedSlashes': site.get('AllowEncodedSlashes'), |
|
|
|
|
|
|
|
|
'AllowEncodedSlashes': site.get('AllowEncodedSlashes', 'Off'), |
|
|
|
|
|
|
|
|
'LogLevel': site.get('LogLevel', 'warn'), |
|
|
'LogLevel': site.get('LogLevel', 'warn'), |
|
|
'ErrorLog': site.get('ErrorLog', '{0}/{1}-error.log'.format(map.logdir, sitename)), |
|
|
'ErrorLog': site.get('ErrorLog', '{0}/{1}-error.log'.format(map.logdir, sitename)), |
|
|
|
|
|
|
|
|
'Allow': 'from all', |
|
|
'Allow': 'from all', |
|
|
'Require': 'all granted', |
|
|
'Require': 'all granted', |
|
|
}, |
|
|
}, |
|
|
} %} |
|
|
|
|
|
|
|
|
} -%} |
|
|
|
|
|
|
|
|
{% for intf in vals.interfaces -%} |
|
|
{% for intf in vals.interfaces -%} |
|
|
Listen {{ intf }}:{{ vals.port }} |
|
|
Listen {{ intf }}:{{ vals.port }} |
|
|
{% endfor %} |
|
|
{% endfor %} |
|
|
|
|
|
|
|
|
<VirtualHost {%- for intf in vals.interfaces %} {{intf}}:{{ vals.port }}{% endfor -%}> |
|
|
|
|
|
|
|
|
<VirtualHost {% for intf in vals.interfaces %} {{intf}}:{{ vals.port }}{% endfor -%}> |
|
|
ServerName {{ vals.ServerName }} |
|
|
ServerName {{ vals.ServerName }} |
|
|
{% if site.get('ServerAlias') != False %}ServerAlias {{ vals.ServerAlias }}{% endif %} |
|
|
{% if site.get('ServerAlias') != False %}ServerAlias {{ vals.ServerAlias }}{% endif %} |
|
|
|
|
|
|
|
|
{% if site.get('ServerAdmin') != False %}ServerAdmin {{ vals.ServerAdmin }}{% endif %} |
|
|
|
|
|
|
|
|
{% if site.get('ServerAdmin') != False %}ServerAdmin {{ vals.ServerAdmin }}{% endif -%} |
|
|
|
|
|
|
|
|
{% if site.get('DirectoryIndex') %}DirectoryIndex {{ vals.DirectoryIndex }}{% endif %} |
|
|
|
|
|
{% if site.get('UseCanonicalName') %}UseCanonicalName {{ vals.UseCanonicalName }}{% endif %} |
|
|
|
|
|
{% if site.get('AllowEncodedSlashes') != False %}AllowEncodedSlashes {{ vals.AllowEncodedSlashes }}{% endif %} |
|
|
|
|
|
|
|
|
{% if site.get('DirectoryIndex') -%}DirectoryIndex {{ vals.DirectoryIndex }}{% endif %} |
|
|
|
|
|
{% if site.get('UseCanonicalName') -%}UseCanonicalName {{ vals.UseCanonicalName }}{% endif %} |
|
|
|
|
|
{% if site.get('AllowEncodedSlashes') != False -%}AllowEncodedSlashes {{ vals.AllowEncodedSlashes }}{% endif %} |
|
|
|
|
|
|
|
|
{% if site.get('LogLevel') != False %}LogLevel {{ vals.LogLevel }}{% endif %} |
|
|
|
|
|
{% if site.get('ErrorLog') != False %}ErrorLog {{ vals.ErrorLog }}{% endif %} |
|
|
|
|
|
{% if site.get('CustomLog') != False %}CustomLog {{ vals.CustomLog }} {{ vals.LogFormat }}{% endif %} |
|
|
|
|
|
|
|
|
{% if site.get('LogLevel') != False -%}LogLevel {{ vals.LogLevel }}{% endif %} |
|
|
|
|
|
{% if site.get('ErrorLog') != False -%}ErrorLog {{ vals.ErrorLog }}{% endif %} |
|
|
|
|
|
{% if site.get('CustomLog') != False -%}CustomLog {{ vals.CustomLog }} {{ vals.LogFormat }}{% endif %} |
|
|
|
|
|
|
|
|
{% if site.get('DocumentRoot') != False %}DocumentRoot {{ vals.DocumentRoot }}{% endif %} |
|
|
|
|
|
{% if site.get('VirtualDocumentRoot') %}VirtualDocumentRoot {{ vals.VirtualDocumentRoot }}{% endif %} |
|
|
|
|
|
|
|
|
{% if site.get('DocumentRoot') != False -%}DocumentRoot {{ vals.DocumentRoot }}{% endif %} |
|
|
|
|
|
{% if site.get('VirtualDocumentRoot') -%}VirtualDocumentRoot {{ vals.VirtualDocumentRoot }}{% endif %} |
|
|
|
|
|
|
|
|
{% if site.get('SSLCertificateFile') %} |
|
|
|
|
|
|
|
|
{%- if site.get('SSLCertificateFile') %} |
|
|
SSLEngine on |
|
|
SSLEngine on |
|
|
SSLCertificateFile {{ site.SSLCertificateFile }} |
|
|
SSLCertificateFile {{ site.SSLCertificateFile }} |
|
|
{% if site.get('SSLCertificateKeyFile') %} |
|
|
|
|
|
|
|
|
{%- if site.get('SSLCertificateKeyFile') %} |
|
|
SSLCertificateKeyFile {{ site.SSLCertificateKeyFile }} |
|
|
SSLCertificateKeyFile {{ site.SSLCertificateKeyFile }} |
|
|
{% endif %} |
|
|
|
|
|
{% if site.get('SSLCertificateChainFile') %} |
|
|
|
|
|
|
|
|
{%- endif %} |
|
|
|
|
|
{%- if site.get('SSLCertificateChainFile') %} |
|
|
SSLCertificateChainFile {{ site.SSLCertificateChainFile}} |
|
|
SSLCertificateChainFile {{ site.SSLCertificateChainFile}} |
|
|
{% endif %} |
|
|
|
|
|
{% endif %} |
|
|
|
|
|
|
|
|
{%- endif %} |
|
|
|
|
|
{%- endif %} |
|
|
|
|
|
|
|
|
{% for loc, path in site.get('Alias', {}).items() %} |
|
|
|
|
|
|
|
|
{%- for loc, path in site.get('Alias', {}).items() %} |
|
|
Alias {{ loc }} {{ path }} |
|
|
Alias {{ loc }} {{ path }} |
|
|
{% endfor %} |
|
|
|
|
|
|
|
|
{%- endfor %} |
|
|
|
|
|
|
|
|
{% for path, dir in site.get('Directory', {}).items() %} |
|
|
|
|
|
{% set dvals = { |
|
|
|
|
|
|
|
|
{%- for path, dir in site.get('Directory', {}).items() -%} |
|
|
|
|
|
{%- set dvals = { |
|
|
'Options': dir.get('Options', vals.Directory.Options), |
|
|
'Options': dir.get('Options', vals.Directory.Options), |
|
|
'Order': dir.get('Order', vals.Directory.Order), |
|
|
'Order': dir.get('Order', vals.Directory.Order), |
|
|
'Allow': dir.get('Allow', vals.Directory.Allow), |
|
|
'Allow': dir.get('Allow', vals.Directory.Allow), |
|
|
|
|
|
|
|
|
'Dav': dir.get('Dav', False), |
|
|
'Dav': dir.get('Dav', False), |
|
|
} %} |
|
|
} %} |
|
|
|
|
|
|
|
|
{% if path == 'default' %}{% set path = vals.Directory_default %}{% endif %} |
|
|
|
|
|
|
|
|
{%- if path == 'default' %}{% set path = vals.Directory_default %}{% endif %} |
|
|
|
|
|
|
|
|
<Directory "{{ path }}"> |
|
|
<Directory "{{ path }}"> |
|
|
{% if dvals.get('Options') != False %}Options {{ dvals.Options }}{% endif %} |
|
|
{% if dvals.get('Options') != False %}Options {{ dvals.Options }}{% endif %} |
|
|
|
|
|
|
|
|
{{ dir.Formula_Append|indent(8) }} |
|
|
{{ dir.Formula_Append|indent(8) }} |
|
|
{% endif %} |
|
|
{% endif %} |
|
|
</Directory> |
|
|
</Directory> |
|
|
{% endfor %} |
|
|
|
|
|
|
|
|
{%- endfor %} |
|
|
|
|
|
|
|
|
{% for path, loc in site.get('Location', {}).items() %} |
|
|
|
|
|
{% set lvals = { |
|
|
|
|
|
|
|
|
{%- for path, loc in site.get('Location', {}).items() %} |
|
|
|
|
|
{%- set lvals = { |
|
|
'Order': loc.get('Order', vals.Location.Order), |
|
|
'Order': loc.get('Order', vals.Location.Order), |
|
|
'Allow': loc.get('Allow', vals.Location.Allow), |
|
|
'Allow': loc.get('Allow', vals.Location.Allow), |
|
|
'Require': loc.get('Require', vals.Location.Require), |
|
|
'Require': loc.get('Require', vals.Location.Require), |
|
|
|
|
|
|
|
|
} %} |
|
|
} %} |
|
|
|
|
|
|
|
|
<Location "{{ path }}"> |
|
|
<Location "{{ path }}"> |
|
|
{% if apache.use_require %} |
|
|
|
|
|
{% if lvals.get('Require') != False %}Require {{lvals.Require}}{% endif %} |
|
|
|
|
|
|
|
|
{%- if apache.use_require %} |
|
|
|
|
|
{%- if lvals.get('Require') != False %}Require {{lvals.Require}}{% endif %} |
|
|
{% else %} |
|
|
{% else %} |
|
|
{% if lvals.get('Order') != False %}Order {{ lvals.Order }}{% endif %} |
|
|
|
|
|
{% if lvals.get('Allow') != False %}Allow {{ lvals.Allow }}{% endif %} |
|
|
|
|
|
|
|
|
{%- if lvals.get('Order') != False %}Order {{ lvals.Order }}{% endif %} |
|
|
|
|
|
{%- if lvals.get('Allow') != False %}Allow {{ lvals.Allow }}{% endif %} |
|
|
{% endif %} |
|
|
{% endif %} |
|
|
{% if lvals.get('Dav') != False %}Dav On{% endif %} |
|
|
|
|
|
|
|
|
{%- if lvals.get('Dav') != False %}Dav On{% endif %} |
|
|
|
|
|
|
|
|
{% if loc.get('Formula_Append') %} |
|
|
|
|
|
|
|
|
{%- if loc.get('Formula_Append') %} |
|
|
{{ loc.Formula_Append|indent(8) }} |
|
|
{{ loc.Formula_Append|indent(8) }} |
|
|
{% endif %} |
|
|
{% endif %} |
|
|
</Location> |
|
|
</Location> |
|
|
{% endfor %} |
|
|
{% endfor %} |
|
|
|
|
|
|
|
|
{% if site.get('Formula_Append') %} |
|
|
|
|
|
|
|
|
{%- if site.get('Formula_Append') %} |
|
|
{{ site.Formula_Append|indent(4) }} |
|
|
{{ site.Formula_Append|indent(4) }} |
|
|
{% endif %} |
|
|
{% endif %} |
|
|
</VirtualHost> |
|
|
</VirtualHost> |