繁体   English   中英

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

[英]NginX - path frameworks with index.php slash path slash path

我正在构建一个 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 文件的样子:

server {

    listen 8100 default_server;
    listen [::]:8100 default_server ipv6only=on;

    server_name localhost;
    root /var/www/public;
    index index.php index.html index.htm;

    location / {

        add_header 'Access-Control-Allow-Origin' '*';
        add_header "Access-Control-Allow-Headers" "Authorization, Origin, X-Requested-With, Content-Type, Accept";
        add_header "Access-Control-Allow-Methods" "GET, POST, OPTIONS, HEAD";

        if ($request_method = 'OPTIONS') {
          add_header 'Access-Control-Allow-Origin' '*';
           #
           # Tell client that this pre-flight info is valid for 20 days
           #
           add_header 'Access-Control-Max-Age' 1728000;
           return 204;
        }

        try_files $uri $uri/ =404;
    }

    location ~ \.php$ {
        try_files $uri $uri/ index.php?$args;


        fastcgi_pass php-fpm-56:9000;
        fastcgi_index index.php;
        fastcgi_buffers 16 16k;
        fastcgi_buffer_size 32k;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        #fixes timeouts
        fastcgi_read_timeout 600;
        include fastcgi_params;
    }

    location ~ /\.ht {
        deny all;
    }

}

我在这里做错了什么?

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

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

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

我尝试使用 codeifniter,

举个例子

我会访问

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

在此处输入图片说明

在我尝试这种方式后,结果是根据我所附的

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

谢谢

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM