Manages PHP minor versions
parent
a9ad41b40f
commit
88c6c5a043
|
@ -31,11 +31,11 @@ nginx_helper_dir: '{{ nginx_etc_dir}}/helper'
|
|||
#
|
||||
|
||||
# PHP
|
||||
nginx_php5: false
|
||||
nginx_php7: false
|
||||
nginx_php5_sockets:
|
||||
nginx_php56: false
|
||||
nginx_php70: false
|
||||
nginx_php56_sockets:
|
||||
- unix_socket: "/run/php5-fpm.sock"
|
||||
nginx_php7_sockets:
|
||||
nginx_php70_sockets:
|
||||
- unix_socket: "/run/php/php7.0-fpm.sock"
|
||||
nginx_upstreams: []
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
PHP
|
||||
===
|
||||
|
||||
- `nginx_php5` and `nginx_php7`: boolean if you need to preconfigure PHP (default: false)
|
||||
- `nginx_php_sockets`: list of sockets (see bellow)
|
||||
- `nginx_php56` and `nginx_php70`: boolean if you need to preconfigure PHP (default: false)
|
||||
- `nginx_php##_sockets`: list of sockets (see bellow)
|
||||
|
||||
You should see [Nginx upstream module doc](http://nginx.org/en/docs/http/ngx_http_upstream_module.html).
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
template: >
|
||||
src=etc/nginx/upstream/php.conf.j2
|
||||
dest="{{ nginx_etc_dir }}/conf.d/php.conf"
|
||||
when: nginx_php5 or nginx_php7
|
||||
when: nginx_php56 or nginx_php70
|
||||
notify: reload nginx
|
||||
|
||||
- name: TEMPLATE | Deploy other upstreams
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
{% extends "_base.j2" %}
|
||||
|
||||
{% macro phpv(version) %}
|
||||
{% if version == 5 %}
|
||||
{{ nginx_upstream_php5 -}}
|
||||
{% elif version == 7 %}
|
||||
{{ nginx_upstream_php7 -}}
|
||||
{% if version == 56 %}
|
||||
{{ nginx_upstream_php56 -}}
|
||||
{% elif version == 70 %}
|
||||
{{ nginx_upstream_php70 -}}
|
||||
{% else %}
|
||||
{# Hack... define another upstream #}
|
||||
{{ version -}}
|
||||
|
@ -13,10 +13,10 @@
|
|||
|
||||
{% if item.php_version is defined %}
|
||||
{% set php_upstream = phpv(item.php_version) %}
|
||||
{% elif nginx_php5 %}
|
||||
{% set php_upstream = phpv(5) %}
|
||||
{% elif nginx_php7 %}
|
||||
{% set php_upstream = phpv(7) %}
|
||||
{% elif nginx_php56 %}
|
||||
{% set php_upstream = phpv(56) %}
|
||||
{% elif nginx_php70 %}
|
||||
{% set php_upstream = phpv(70) %}
|
||||
{% endif %}
|
||||
|
||||
{% block template_index %}
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
# {{ ansible_managed }}
|
||||
#
|
||||
|
||||
{% if nginx_php5 %}
|
||||
upstream {{ nginx_upstream_php5 }} {
|
||||
{% for item in nginx_php5_sockets %}
|
||||
{% if nginx_php56 %}
|
||||
upstream {{ nginx_upstream_php56 }} {
|
||||
{% for item in nginx_php56_sockets %}
|
||||
{% if item.unix_socket is defined %}
|
||||
server unix:{{ item.unix_socket }} weight={{ item.weight | default('1') }};
|
||||
{% else %}
|
||||
|
@ -14,9 +14,9 @@ upstream {{ nginx_upstream_php5 }} {
|
|||
}
|
||||
|
||||
{% endif %}
|
||||
{% if nginx_php7 %}
|
||||
upstream {{ nginx_upstream_php7 }} {
|
||||
{% for item in nginx_php7_sockets %}
|
||||
{% if nginx_php70 %}
|
||||
upstream {{ nginx_upstream_php70 }} {
|
||||
{% for item in nginx_php70_sockets %}
|
||||
{% if item.unix_socket is defined %}
|
||||
server unix:{{ item.unix_socket }} weight={{ item.weight | default('1') }};
|
||||
{% else %}
|
||||
|
|
|
@ -21,7 +21,9 @@
|
|||
- fcgiwrap
|
||||
- nghttp2
|
||||
- php5-fpm
|
||||
- php5-sqlite
|
||||
- php7.0-fpm
|
||||
- php7.0-sqlite3
|
||||
- strace
|
||||
- vim
|
||||
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
set_fact:
|
||||
nginx_pkgng_package: 'nginx-devel'
|
||||
nginx_user: 'www'
|
||||
nginx_php7: false
|
||||
nginx_php5_sockets:
|
||||
nginx_php70: false
|
||||
nginx_php56_sockets:
|
||||
- host: '127.0.0.1'
|
||||
port: 9000
|
||||
|
||||
|
|
|
@ -17,8 +17,8 @@
|
|||
nginx_worker_processes: 1 # Ansible+FreeBSD can't detect CPU number
|
||||
nginx_apt_package: 'nginx-extras'
|
||||
nginx_backports: true
|
||||
nginx_php5: true
|
||||
nginx_php7: true
|
||||
nginx_php56: true
|
||||
nginx_php70: true
|
||||
nginx_upstreams:
|
||||
- name: 'test'
|
||||
servers:
|
||||
|
@ -147,7 +147,7 @@
|
|||
'/':
|
||||
- 'alias /var/tmp;'
|
||||
- name: 'test-php.local'
|
||||
php_version: 7
|
||||
php_version: 70
|
||||
upstream_params:
|
||||
- 'fastcgi_param FOO bar;'
|
||||
redirect_from:
|
||||
|
|
|
@ -33,5 +33,5 @@ nginx_templates_no_dir:
|
|||
- '_owncloud'
|
||||
- '_proxy'
|
||||
|
||||
nginx_upstream_php5: 'php5'
|
||||
nginx_upstream_php7: 'php7'
|
||||
nginx_upstream_php56: 'php56'
|
||||
nginx_upstream_php70: 'php70'
|
||||
|
|
Loading…
Reference in New Issue