Manage vhost aliases

pull/2/head
Emilien Mantel 2015-07-15 17:57:42 +02:00
parent 73a68a15b1
commit 596aaefb31
2 changed files with 9 additions and 4 deletions

View File

@ -1,15 +1,17 @@
{% set server_name = [ item.name ] %}
{% set aliases = item.aliases if item.aliases is defined else [] %}
{% set ignore = server_name.extend(aliases) %}
{% if item.ssl is defined and item.ssl.use is defined and item.ssl.use %} {% if item.ssl is defined and item.ssl.use is defined and item.ssl.use %}
listen {{ item.listen | default('443') }}; listen {{ item.listen | default('443') }};
# server_name {{ item.name | join(' ')}}; # TODO: gérer plusieurs vhosts server_name {{ server_name | join(' ') }};
server_name {{ item.name }};
ssl on; ssl on;
ssl_certificate {{ nginx_ssl_dir }}/{{ item.name }}/{{ item.name }}.crt; ssl_certificate {{ nginx_ssl_dir }}/{{ item.name }}/{{ item.name }}.crt;
ssl_certificate_key {{ nginx_ssl_dir }}/{{ item.name }}/{{ item.name }}.key; ssl_certificate_key {{ nginx_ssl_dir }}/{{ item.name }}/{{ item.name }}.key;
include /etc/nginx/helpers/ssl-{{ item.ssl.template | default('strong') }}; include /etc/nginx/helpers/ssl-{{ item.ssl.template | default('strong') }};
{% else %} {% else %}
listen {{ item.listen | default('80') }}; listen {{ item.listen | default('80') }};
# server_name {{ item.name | join(' ')}}; # TODO: gérer plusieurs vhosts server_name {{ server_name | join(' ') }};
server_name {{ item.name }};
{% endif %} {% endif %}
root {{ nginx_root }}/{{ item.name }}/public; root {{ nginx_root }}/{{ item.name }}/public;

View File

@ -10,6 +10,9 @@
nginx_php: true nginx_php: true
nginx_vhosts: nginx_vhosts:
- name: 'test.local' - name: 'test.local'
aliases:
- test-alias.local
- test2-alias.local
template: 'static' template: 'static'
ssl: ssl:
use: false use: false