Better PHP and vhost management
parent
57882393b8
commit
5d084416e1
|
@ -14,7 +14,11 @@
|
||||||
server_name {{ server_name | join(' ') }};
|
server_name {{ server_name | join(' ') }};
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
{% if item.root is defined %}
|
||||||
|
root {{ item.root }};
|
||||||
|
{% else %}
|
||||||
root {{ nginx_root }}/{{ item.name }}/public;
|
root {{ nginx_root }}/{{ item.name }}/public;
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{% if item.use_access_log is defined and item.use_access_log %}
|
{% if item.use_access_log is defined and item.use_access_log %}
|
||||||
access_log {{ nginx_log_dir }}/{{ item.name }}_access.log combined;
|
access_log {{ nginx_log_dir }}/{{ item.name }}_access.log combined;
|
||||||
|
|
|
@ -1,22 +1,15 @@
|
||||||
#
|
#
|
||||||
# {{ ansible_managed }}
|
# {{ ansible_managed }}
|
||||||
#
|
#
|
||||||
{% if nginx_php_method == 'tcp' %}
|
|
||||||
upstream php {
|
upstream php {
|
||||||
{% if nginx_cluster_php_method is defined %}
|
{% for item in nginx_php_sockets %}
|
||||||
{{ nginx_cluster_php_method }};
|
{% if item.unix_socket is defined %}
|
||||||
|
server unix:{{ item.unix_socket }} weight={{ item.weight | default('1') }};
|
||||||
|
{% else %}
|
||||||
|
server {{ item.host }}:{{ item.port }} weight={{ item.weight | default('1') }} max_fails={{ item.max_fails | default('5') }} fail_timeout={{ item.fail_timeout | default('10s') }};
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% for item in nginx_php_tcp_sockets %}
|
|
||||||
server {{ item.host }}:{{ item.port }} weight={{ item.weight | default('100') }} max_fails={{ item.max_fails | default('5') }} fail_timeout={{ item.fail_timeout | default('10s') }};
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
}
|
}
|
||||||
{% elif nginx_php_method == 'unix' %}
|
|
||||||
upstream php {
|
|
||||||
{% for item in nginx_php_unix_sockets %}
|
|
||||||
server unix:{{ item }};
|
|
||||||
{% endfor %}
|
|
||||||
}
|
|
||||||
{% else %}
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
# vim:filetype=nginx
|
# vim:filetype=nginx
|
||||||
|
|
|
@ -8,6 +8,8 @@
|
||||||
- lineinfile: dest=/etc/hosts line="127.0.2.2 {{ nginx_vhosts|map(attribute='name')| join(' ') }}"
|
- lineinfile: dest=/etc/hosts line="127.0.2.2 {{ nginx_vhosts|map(attribute='name')| join(' ') }}"
|
||||||
vars:
|
vars:
|
||||||
nginx_php: true
|
nginx_php: true
|
||||||
|
nginx_php_unix_sockets:
|
||||||
|
- unix_socket: "/var/run/php5-fpm.sock"
|
||||||
nginx_vhosts:
|
nginx_vhosts:
|
||||||
- name: 'test.local'
|
- name: 'test.local'
|
||||||
aliases:
|
aliases:
|
||||||
|
|
Loading…
Reference in New Issue