roles/nginx: Tweaks for vhosts with WordPress

My WordPress blogs have a /wordpress subdirectory in the document
root, but I don't serve from the /wordpress URI.

Technically, all we need is the tweaks to the try_files:
    - `?args` passes query strings to php5-fpm
    - removing 404 from the vhost's try_files so we don't return 404
    when the requested file doesn't exist (obviously not all request
    URI's in WordPress are actual files on the disk)

Signed-off-by: Alan Orth <alan.orth@gmail.com>
This commit is contained in:
2014-09-07 22:51:34 +03:00
parent df65172952
commit 2156f8b07d
2 changed files with 14 additions and 3 deletions

View File

@ -0,0 +1,10 @@
# try for WordPress index.php in /
# fall back to index.php + args (passed to php5-fpm later)
location / {
try_files $uri $uri/ /index.php?$args;
}
# Add trailing slash to */wp-admin requests.
rewrite /wp-admin$ $scheme://$host$uri/ permanent;