mirror of
https://github.com/HanXHX/ansible-nginx.git
synced 2026-02-24 09:03:29 +07:00
Fix and improve tests/vhosts + php_index vhost
This commit is contained in:
@@ -16,7 +16,7 @@ server {
|
||||
{% if item.root is defined %}
|
||||
root {{ item.root }};
|
||||
{% else %}
|
||||
root {{ nginx_root }}/{{ item.name[0] }}/public;
|
||||
root {{ nginx_root }}/{{ item.name if item.name is string else item.name[0] }}/public;
|
||||
{% endif %}
|
||||
{% block template_index %}
|
||||
index {{ item.index | default('index.html index.htm') }};
|
||||
|
||||
24
templates/etc/nginx/sites-available/_php_index.j2
Normal file
24
templates/etc/nginx/sites-available/_php_index.j2
Normal file
@@ -0,0 +1,24 @@
|
||||
{% extends "_php.j2" %}
|
||||
|
||||
{% block template_upstream_location %}
|
||||
location = /index.php {
|
||||
fastcgi_pass php;
|
||||
fastcgi_index index.php;
|
||||
{% if item.upstream_params is defined and item.upstream_params is iterable %}
|
||||
{% for param in item.upstream_params %}
|
||||
{{ param }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% if nginx_version.stdout | version_compare('1.6.1', 'lt') %}
|
||||
include fastcgi_params;
|
||||
{% else %}
|
||||
include fastcgi.conf;
|
||||
{% endif %}
|
||||
}
|
||||
{% endblock %}
|
||||
|
||||
{% block template_custom_location %}
|
||||
location ~ \.(php\d?|phtml)$ {
|
||||
return 403;
|
||||
}
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user