try-files and Gallery3 rewriting

António P. P. Almeida appa at perusio.net
Thu Jun 9 02:35:11 MSD 2011


On 8 Jun 2011 23h26 WEST, appa at perusio.net wrote:

> On 8 Jun 2011 22h43 WEST, mail at andreas-lehr.com wrote:
>
>> Hiho,
>>
>> I am currently running gallery3 on nginx/php-fpm. Works like a
>> charm so far.  But i'd like to get gallery3 also under the hood of
>> try-files, but didn't get it running up to now.
>>
>> The working (and evil) if rewrite code looks like this:
>>
>> location /gallery3/ {
>> if (!-e $request_filename) {
>> rewrite ^/gallery3/index.php/(.+)$
>> /gallery3/index.php?kohana_uri=$1 last;
>> rewrite ^/gallery3/(.+)$
>> /gallery3/index.php?kohana_uri=$1 last;
>> rewrite ^/gallery3/$ /gallery3/index.php?kohana_uri=/
>> last;
>> }
>>
>> }
>> Could anybody supply a correct try_files directive and explain how
>> and why try_files should do the stuff in this case?
>
Oops. There was a superfluous URI being tried. Here it is: 

location /gallery3 {

  location /gallery3(.*)$ {
    try_files $uri /gallery3/index.php$1 /gallery3/index.php?kohana_uri=$1;
  }

  ## You need this here to make it work with the nested location.
  location /gallery3/index.php {
    (fastcgi or proxy_pass stuff here)
  }
}

--- appa




More information about the nginx mailing list