Help with Rewrite Rules for Wordpress MU with try_files


#1

Hello!

I’ve successfully using nginx with rewrite rules for wordpress MU, but
still
using “if”.

How can I make it works with try_files? Which as I known is faster

The old rewrite rules is

if (-f $request_filename) {

break;

}

if (-d $request_filename) {

break;

}

rewrite ^./files/(.) /wp-content/blogs.php?file=$1;

if (!-e $request_filename) {

rewrite ^.+/?(/wp-.*) $1 last;

rewrite ^.+/?(/.*.php)$ $1 last;

rewrite ^(.+)$ /index.php?q=$1 last;

}

I tried this try_files

location / {

try_files $uri $uri/ @wordpress;

index index.php index.html index.htm;

}

location ~ .php$ {

try_files $uri @wordpress;

fastcgi_pass unix:/tmp/php-fpm.sock;

fastcgi_index index.php;

fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

include fastcgi_params;

}

location @wordpress {

fastcgi_pass unix:/tmp/php-fpm.sock;

fastcgi_param SCRIPT_FILENAME $document_root/index.php;

include fastcgi_params;

}

But can’t get the jpg files appears