NginX-具有index.php的路径框架斜杠路径斜杠路径

时间:2020-10-19 15:50:35

标签: php laravel codeigniter nginx

我正在构建一个Docker集合,该集合最终将具有以下容器(以及更多)

网络(nginx)

代理(反向代理Nginx)

php-fpm

网络将允许通过文件夹和子文件夹添加多个框架

./ folder1 / folder2 / codeigniter ./folder3/folder4/laravel

codeigniter和laravel的文件夹是指向公共文件夹的符号链接

index.php页面正常工作,并显示默认路由而没有问题。

但是当我尝试进入另一个页面时,例如 /folder3/folder4/laravel/index.php/path/somwhere

我收到404错误消息。

我希望能够在不为每个文件夹映射nginx位置指令的情况下执行此操作...

这是我的conf文件的样子:

$products = json_decode($products, true);  // Return array of array.

foreach($products as $product){
    echo $product['name']; 
}

我在做什么错了?

请记住,我要使用“ /folder/index.php/path/path”

我不想 “ /文件夹/路径/路径”

我也不希望为我创建的每个新文件夹创建一个位置条目

1 个答案:

答案 0 :(得分:0)

我尝试使用codeifniter,

作为示例

我将访问

http://192.168.100.100/CI/CI_1/CI_1/index.php/main/index

enter image description here

以这种方式尝试后,结果取决于我所附加的内容

location  /CI/CI_1/CI_1 {
  autoindex on;
  try_files $uri $uri/ /CI/CI_1/CI_1/index.php?/$request_uri;
}

谢谢