nginx+php-fpm问题无法调用文件夹中的其他php文件


nginx+php-fpm issue not able to call other php files in folder

我有一个nginx和php-fpm配置,但当我从浏览器访问它时,只有index.php被执行,但其他文件我无法调用。

nginx配置

{
user  nginx;
worker_processes  auto;
error_log  /var/log/nginx/error.log warn;
pid        /var/run/nginx.pid;
events {
    worker_connections  1024;
    use epoll;
    multi_accept on;
}
http {
keepalive_timeout 15;
    keepalive_requests 2048;
    server_tokens off;
   upstream php
{
    server unix:/tmp/php-cgi.socket;
   server serverip:9000;
}
 access_log  /var/log/nginx/access.log  main;
include /etc/nginx/conf.d/*.conf;
}

/etc/nginx/conf.d/中的配置

    server {
        root /var/www/Cachet/public/;
       location / {
     try_files $uri $uri/ /index.php index.php;
    }
        server_name  serverip ; # Or whatever you want to use
        listen 80 default;
        location ~* '.php$ {
                    fastcgi_split_path_info ^(.+'.php)(/.+)$;
                    fastcgi_pass unix:/var/run/php5-fpm.sock;
                    fastcgi_index index.php;
                    fastcgi_keep_conn on;
                    include fastcgi_params;
                    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        }


}

以下是error.log和access.log 中的几行

2015/11/06 12:40:53[错误]19346#0:*1在stderr中发送了FastCGI:"无法打开主脚本:/var/www/Cachet/public/dashboard.php(没有这样的文件或目录)"上游,客户端:客户端IP,服务器:服务器IP,请求:"GET/dashboard.php HTTP/1.1",上游:"fastcgi://unix:/var/run/php5-fpm.sock:",主机:"服务器IP"

2015/11/06 12:41:05[错误]19346#0:*1在stderr中发送了FastCGI:"无法打开主脚本:/var/www/Cachet/public/autoload.php(没有这样的文件或目录)"上游,客户端:客户端IP,服务器:服务器IP,请求:"GET/autoload.php HTTP/1.1",上游:"fastcgi://unix:/var/run/php5-fpm.sock:",主机:"服务器IP"

由于这里没有响应,在同事的帮助下,我在配置文件中发现了两个问题,因此我无法调用单独文件夹中的多个php文件。。

try_files $uri $uri/ /index.php index.php; 
instead it needed 
try_files $uri $uri/ /index.php$is_args$args;

Alos,因为它没有加载图像,所以缺少的行是包括/etc/nginx/meme.types;在conf.d/default.conf的位置块中。

检查您安装的PHP版本和config.d中的PHP版本是否不匹配。如果是这种情况,请将conf.d文件中的PHP版本更改为已安装的PHP版本。重新加载发动机。

fastcgi_pass unix:/var/run/php5-fpm.sock;