Forum: NGINX Help with Rewrite Rules for Wordpress MU with try_files

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
103e3ecb1c838c6c7e52a0ee12ee6e1a?d=identicon&s=25 Glen Lumanau (Guest)
on 2009-06-09 06:11
(Received via mailing list)
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
This topic is locked and can not be replied to.