Can fastcgi_index be used with multiple filenames?
    Igor Sysoev 
    is at rambler-co.ru
       
    Sat Mar  8 11:00:03 MSK 2008
    
    
  
On Sat, Mar 08, 2008 at 02:28:52AM -0500, Ian M. Evans wrote:
> Switching over to fastcgi php...
> 
> We use parse both .php and .shtml as php files. From looking at the 
> syntax for fastcgi_index it looks like just one filename can follow it, 
> e.g.:
> 
> fastcgi_index index.shtml;
> 
> but can it be
> 
> fastcgi_index index.shtml index.php;
No.
The problem is that if fastcgi is on remote server, nginx does not what
index file should be choosed for ".../". See $fastcgi_script_name variable
http://wiki.codemongers.com/NginxHttpFcgiModule#var_fastcgi_script_name
If php root and static root are the same, then you can use following:
    location / {
        index   index.shtml   index.php;
        # static
    }
    location \.(php|shtml)$ {
        fastcgi_pass  ...
        # fastcgi_index is not needed here at all
    }
When nginx finds index.shtml or index.php in "location /", it does
internal redirect and request will be processed in "location \.(php|shtml)$".
-- 
Igor Sysoev
http://sysoev.ru/en/
    
    
More information about the nginx
mailing list