mirror of
https://github.com/HanXHX/ansible-nginx.git
synced 2026-02-24 09:03:29 +07:00
Drop PHP version support (useless) + fix some bugs
This commit is contained in:
@@ -3,15 +3,13 @@
|
||||
#
|
||||
|
||||
{% for php in nginx_php %}
|
||||
upstream {{ php.upstream_name | default((php.version | php_default_upstream_name)) }} {
|
||||
upstream {{ php.upstream_name }} {
|
||||
{% for sock in php.sockets | default([]) %}
|
||||
{% if sock.host is defined %}
|
||||
server {{ sock.host }}:{{ sock.port }} weight={{ sock.weight | default('1') }} max_fails={{ sock.max_fails | default('5') }} fail_timeout={{ sock.fail_timeout | default('10s') }};
|
||||
{% else %}
|
||||
server unix:{{ sock.unix | default((php.version | php_default_upstream_socket)) }} weight={{ sock.weight | default('1') }};
|
||||
server unix:{{ sock.unix }} weight={{ sock.weight | default('1') }};
|
||||
{% endif %}
|
||||
{% else %}
|
||||
server unix:{{ php.version | php_default_upstream_socket }} weight=1;
|
||||
{% endfor %}
|
||||
}
|
||||
{% endfor %}
|
||||
|
||||
@@ -1,16 +1,5 @@
|
||||
{% extends "_base.j2" %}
|
||||
|
||||
{% if item.php_version is defined %}
|
||||
{% set php_info = 'Explicit PHP version on site' %}
|
||||
{% set php_upstream = (nginx_php|selectattr('version', 'equalto', item.php_version)|first).upstream_name | default(item.php_version | php_default_upstream_name) %}
|
||||
{% elif item.php_upstream is defined %}
|
||||
{% set php_info = 'Explicit Nginx/PHP upstream on site' %}
|
||||
{% set php_upstream = item.php_upstream %}
|
||||
{% else %}
|
||||
{% set php_info = 'Warning: using first PHP version on config' %}
|
||||
{% set php_upstream = nginx_php.0.upstream_name | default(nginx_php.0.version | php_default_upstream_name) %}
|
||||
{% endif %}
|
||||
|
||||
{% block template_index %}
|
||||
index {{ item.index | default('index.html index.htm index.php') }};
|
||||
{% endblock %}
|
||||
@@ -21,8 +10,7 @@
|
||||
|
||||
{% block template_upstream_location %}
|
||||
location ~ \.php$ {
|
||||
# {{ php_info }}
|
||||
fastcgi_pass {{ php_upstream }};
|
||||
fastcgi_pass {{ item.php_upstream }};
|
||||
fastcgi_index index.php;
|
||||
{% if item.upstream_params is defined and item.upstream_params is iterable %}
|
||||
{% for param in item.upstream_params %}
|
||||
|
||||
@@ -2,8 +2,7 @@
|
||||
|
||||
{% block template_upstream_location %}
|
||||
location = /index.php {
|
||||
# {{ php_info }}
|
||||
fastcgi_pass {{ php_upstream }};
|
||||
fastcgi_pass {{ item.php_upstream }};
|
||||
fastcgi_index index.php;
|
||||
{% if item.upstream_params is defined and item.upstream_params is iterable %}
|
||||
{% for param in item.upstream_params %}
|
||||
|
||||
@@ -6,8 +6,7 @@
|
||||
|
||||
{% block template_upstream_location %}
|
||||
location = /index.php {
|
||||
# {{ php_info }}
|
||||
fastcgi_pass {{ php_upstream }};
|
||||
fastcgi_pass {{ item.php_upstream }};
|
||||
fastcgi_index index.php;
|
||||
{% if item.upstream_params is defined and item.upstream_params is iterable %}
|
||||
{% for param in item.upstream_params %}
|
||||
|
||||
@@ -10,8 +10,7 @@
|
||||
}
|
||||
|
||||
location ~ ^/index\.php(/|$) {
|
||||
# {{ php_info }}
|
||||
fastcgi_pass {{ php_upstream }};
|
||||
fastcgi_pass {{ item.php_upstream }};
|
||||
fastcgi_index index.php;
|
||||
{% if item.upstream_params is defined and item.upstream_params is iterable %}
|
||||
{% for param in item.upstream_params %}
|
||||
|
||||
Reference in New Issue
Block a user