Problems with fastcgi php migration

Igor Sysoev is at rambler-co.ru
Thu Mar 13 16:05:47 MSK 2008


On Thu, Mar 13, 2008 at 08:53:35AM -0400, Ian M. Evans wrote:

> Igor Sysoev wrote:
> >The "if" block is ugly construction inside nginx.
> >It requires fastcgi_pass inside "if" block too.
> >It's not enough fastcgi_pass at the bottom of the location.
> 
> 
> It's now in both places and there's no change. All the root level files 
> (example.com/filename) work. 99% there as we just need to be to find the 
> filename in any directory.
> 
> To reiterate, the only final tweak now is the location regex.
> 
> location ~ ^/(testgalleries|galleries|poll|news|photos)(/|$) {
> 
> Like I said, I suck at regex, but from what I do understand, the
> 
> ^/ is looking at the start of the line so it will find
> /photos but not /subdir/photos or /subdir/subdir/photos (etc.)
> 
> what needs to be changed between ^/ and (testgalleries...) to enable it 
> to work with any number of subdirectories?

If you need throw ways /subdir/subdir/, you can try the followning:

location ~ /(testgalleries|galleries|poll|news|photos)(/|$) {
      root /usr/local/apache/htdocs;

      set  $script_name  $uri;
      set  $path_info    "";

      if ($uri ~ ^/(?:.+/)?(testgalleries|galleries|poll|news|photos)(/.*)) {
            set  $script_name  /$1;
            set  $path_info    $2;
            fastcgi_pass       ...
      }


-- 
Igor Sysoev
http://sysoev.ru/en/





More information about the nginx mailing list