【发布时间】:2016-02-07 07:06:07
【问题描述】:
我有一个 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 FastCGI 在标准错误中发送: “无法打开主脚本:/var/www/Cachet/public/dashboard.php (没有这样的文件或目录)”,同时从 上游,客户端:客户端 IP,服务器:服务器 IP,请求:“GET /dashboard.php HTTP/1.1”,上游: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "服务器IP"
2015/11/06 12:41:05 [错误] 19346#0: *1 FastCGI 在标准错误中发送: “无法打开主脚本:/var/www/Cachet/public/autoload.php (没有这样的文件或目录)”,同时从 上游,客户端:客户端 IP,服务器:服务器 IP,请求:“GET /autoload.php HTTP/1.1",上游: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "服务器IP"
【问题讨论】: