Home > Enterprise >  Nginx index.php not a directory
Nginx index.php not a directory

Time:05-24

I'm a beginner with Nginx I have the below link working fine with apache

https://127.0.0.1/shop/sub-shop1/index.php/product1/property1

but for the same thing with nginx

failed (20: Not a directory)

what is the solution?

CodePudding user response:

Looks like your case if the one where you really need a PATH_INFO being extracted from the URI and passed to your backend PHP app. This is a really rare case nowadays, and while I continue too see attempts to set that PATH_INFO FastCGI variable over and over again among the different configurations like

location ~ \.php$ {
    fastcgi_split_path_info ^(. \.php)(/. )$;
    ...
}

it does not make any sense there because using that kind of PHP handler location no URI that really contains the PATH_INFO will be ever captured with the \.php$ regex pattern. To make it workable use a proper regex pattern like the one suggested in the official PHP FastCGI example:

location ~ [^/]\.php(?:$|/) {
    ...
}
  • Related