mirror of
https://github.com/geerlingguy/ansible-role-apache
synced 2024-12-22 19:10:19 +01:00
547c0b404c
By default I leave it as "*", but for many cases, we don't want to bind our apache to all network addresses available for the server. For example if we want to only bind the apache to the localhost, we can use the following configuration: apache_listen_ip: "127.0.0.1"
69 lines
1.9 KiB
Django/Jinja
69 lines
1.9 KiB
Django/Jinja
{{ apache_global_vhost_settings }}
|
|
|
|
{# Set up VirtualHosts #}
|
|
{% for vhost in apache_vhosts %}
|
|
<VirtualHost {{ apache_listen_ip }}:{{ apache_listen_port }}>
|
|
ServerName {{ vhost.servername }}
|
|
{% if vhost.serveralias is defined %}
|
|
ServerAlias {{ vhost.serveralias }}
|
|
{% endif %}
|
|
{% if vhost.documentroot is defined %}
|
|
DocumentRoot {{ vhost.documentroot }}
|
|
{% endif %}
|
|
|
|
{% if vhost.serveradmin is defined %}
|
|
ServerAdmin {{ vhost.serveradmin }}
|
|
{% endif %}
|
|
{% if vhost.documentroot is defined %}
|
|
<Directory "{{ vhost.documentroot }}">
|
|
AllowOverride All
|
|
Options -Indexes FollowSymLinks
|
|
Order allow,deny
|
|
Allow from all
|
|
</Directory>
|
|
{% endif %}
|
|
{% if vhost.extra_parameters is defined %}
|
|
{{ vhost.extra_parameters }}
|
|
{% endif %}
|
|
</VirtualHost>
|
|
|
|
{% endfor %}
|
|
|
|
{# Set up SSL VirtualHosts. #}
|
|
{% for vhost in apache_vhosts_ssl %}
|
|
<VirtualHost {{ apache_listen_ip }}:{{ apache_listen_port_ssl }}>
|
|
ServerName {{ vhost.servername }}
|
|
{% if vhost.serveralias is defined %}
|
|
ServerAlias {{ vhost.serveralias }}
|
|
{% endif %}
|
|
{% if vhost.documentroot is defined %}
|
|
DocumentRoot {{ vhost.documentroot }}
|
|
{% endif %}
|
|
|
|
SSLEngine on
|
|
SSLCipherSuite {{ apache_ssl_cipher_suite }}
|
|
SSLProtocol {{ apache_ssl_protocol }}
|
|
SSLHonorCipherOrder On
|
|
SSLCertificateFile {{ vhost.certificate_file }}
|
|
SSLCertificateKeyFile {{ vhost.certificate_key_file }}
|
|
{% if vhost.certificate_chain_file is defined %}
|
|
SSLCertificateChainFile {{ vhost.certificate_chain_file }}
|
|
{% endif %}
|
|
|
|
{% if vhost.serveradmin is defined %}
|
|
ServerAdmin {{ vhost.serveradmin }}
|
|
{% endif %}
|
|
{% if vhost.documentroot is defined %}
|
|
<Directory "{{ vhost.documentroot }}">
|
|
AllowOverride All
|
|
Options -Indexes FollowSymLinks
|
|
Order allow,deny
|
|
Allow from all
|
|
</Directory>
|
|
{% endif %}
|
|
{% if vhost.extra_parameters is defined %}
|
|
{{ vhost.extra_parameters }}
|
|
{% endif %}
|
|
</VirtualHost>
|
|
|
|
{% endfor %}
|