NGINX 对错误路径上的文件吸引力

我有一个申请 codeigniter 使用以下目录结构

<home>
|_ <web>
| |_<api>
| |_index.php
|_<admin>

开发商有 index.html 在目录中,和。 文件 codeigniter 开发人员部署的服务在目录中。 开发人员通过将域名添加到域名来访问服务。
http://mydomain/web/API/index.php/v1/GetRoles
主机名配置为变量 BASE PATH 在文件中 javascript.

此应用程序是服务的 NGINX 被...统治 fast-cgi.

虽然加载了HTML页面,但没有加载数据。 因此,我们尝试通过在浏览器中键入URL来访问功能 (
http://mydomain/web/API/index.php/v1/GetRoles
). 我们弄错了 404 Not Found. 错误日志包含以下条目。

2016/05/20 16:14:57 [error] 2127#0: *232 FastCGI sent in stderr: "Unable to open primary script: /home/myname/public_html/domainname/public/projectname/index.php (No such file or directory)" while reading response header from upstream, client: 14.141.163.46, server: mydomain.com, request: "GET /web/API/v1/get/Common/GetActivities HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "mydomain.com"

服务器必须查看 index.php 在 /home/myname/public_html/domainname/public/projectname/web/API/index.php, 而不是寻找它 WEB ROOT.

我的配置 NGINX 如下

server {
listen mydomain.com;
server_name mydomain.com;
root /home/myname/public_html/domainname/public/projectname;

keepalive_timeout 70;
access_log /home/myname/public_html/domainname/log/access.log;
error_log /home/myname/public_html/domainname/log/error.log;

gzip_static on;

index index.html index.php;

location / {
try_files $uri $uri/ /index.php?$query_string;
}

error_page 404 /404.html;

error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/www;
}

# pass the PHP scripts to FastCGI server listening on the php-fpm socket
location ~ \.php$ {
#try_files $uri =404;
#fastcgi_pass unix:/tmp/php5-fpm.sock;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
fastcgi_intercept_errors on;
}
}

我无法理解为什么 NGINX 寻找 index.php 在 WEB ROOT 而不是下载我们介绍的一切 URL. 我们期待着遇到类似问题的每个人的回应。
</admin></api></web></home>
已邀请:

卫东

赞同来自:

据我所知,您正在努力获得

/web/API/v1/get/Common/GetActivities

, 这不是一个真正的文件夹。 你可以做一个位置

/web/API/v1/get/Common/GetActivities

与韩国人

/home/myname/public_html/domainname/public/projectname/web/API

或更改查询路径

/web/API/index.php

要回复问题请先登录注册