nginx/templates/etc/nginx/sites-available/wp.j2

35 lines
896 B
Django/Jinja

{% extends "core.j2" %}
{% block root %}
root {{ nginx_www_dir }}{{ item.root }};
index {{ item.index }};
try_files {{ item.override_try_files | default('$uri $uri/ /index.php') }};
{% endblock %}
{% block location %}
location ~ \.php$ {
{% if item.upstream_params is defined and item.upstream_params is iterable %}
{% for param in item.upstream_params %}
{{ param }}
{% endfor %}
{% endif %}
include fastcgi_params;
}
{% endblock %}
{% block app_specific %}
location ^~ /blogs.dir {
internal;
alias {{ nginx_www_dir }}/{{ item.root }}/wp-content/blogs.dir ;
access_log off;
log_not_found off;
expires max;
}
if (!-e $request_filename) {
rewrite /wp-admin$ $scheme://$host$uri/ permanent;
rewrite ^/[_0-9a-zA-Z-]+(/wp-.*) $1 last;
rewrite ^/[_0-9a-zA-Z-]+(/.*\.php)$ $1 last;
}
{% endblock %}