How to use fastcgi_index?

Michael Schmarck michael.schmarck at habmalnefrage.de
Thu Nov 6 14:32:03 MSK 2008


Hello again!

2008/11/6 Igor Sysoev <is at rambler-co.ru>

> The index directive looks up local filesystem for index files,
> so in following configuration
>
>     location / {
>         root   /data/www;
>         index  index.php;
>     }
>
>     location ~ \.php$ {
>         fastcgi ...
>     }
>
> the index sees /data/www/index.php and does internal redirect to /index.php,
> so the request goes to "location ~ \.php$" and is passed to fastcgi.
>
> However, if fastcgi server is remote one, and nginx has no access to its
> filesystem, then index has no idea about remote index files. The fastcgi_index
> should help here: it simply adds its value to any /dir/, i.e. it maps
> /dir/ to /dir/index.php.
>
>     location ~ (\.php|/)$ {
>         fastcgi_index  index.php;
>         fastcgi_param  SCRIPT_FILENAME  /data/www$fastcgi_script_name;
>     }

Let me see, if I got this right - fastcgi_index is, in my setup,
where nginx and the fastcgi server share filesystems, in such
a setup fastcgi_index doesn't do anything at all and can be
omitted.

Correct?

Michael





More information about the nginx mailing list