ansible/roles/web/templates/nginx.conf.j2

30 lines
928 B
Django/Jinja

server {
server_name {{ item.name }}.chosto.me;
listen {{ nginx_internal_port }};
root /var/www/html;
index index.php index.html index.htm;
location / {
try_files $uri $uri/ /index.php?$query_string;
add_header X-Robots-Tag "noindex, nofollow, nosnippet, noarchive";
autoindex {{ item.autoindex }};
}
{% if item.php == 'true' %}
# PHP-FPM Configuration Nginx
location ~ \.php$ {
add_header X-Robots-Tag "noindex, nofollow, nosnippet, noarchive";
try_files $uri = 404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass php:9000;
fastcgi_index index.php;
include fastcgi_params;
{# Unique PHP container, we need to discriminate files by website name#}
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param SCRIPT_FILENAME {{ item.name }}/$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
{% endif %}
}