我在CentOS 6.6服务器下安装了带有PHP-FPM(PHP 5.5.18)的Nginx 1.6.2。 除了/etc/nginx/conf.d/default.conf文件之外,我没有碰到任何东西,我做了一些修改(见下面):
server { listen 80; server_name webvm devserver ; location / { root /var/www/html; index index.php index.html index.htm; } error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/html; } location ~ \.php$ { try_files $uri =404; root /var/www/html; include fastcgi_params; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; } }
重启Nginx并尝试访问http://devserver/index.php文件后,我得到这个错误:
2014/12/01 19:48:51 [error] 5014#0:* 6从stderr发送的FastCGI:读取来自上游的响应标头“主脚本未知”,客户端:192.168.3.1,server:webvm,request:“GET /index.php HTTP / 1.1“,上游:”fastcgi://127.0.0.1:9000“,主机:”devserver“
我也用ls -l命令检查了/var/www/html权限/所有者,这是输出:
#ls -l /var/www/html/ total 4 -rw-r--r-- 1 root root 23 Dec 1 19:29 index.php
我在PHP-FPM池中没有碰到任何东西,因此/etc/php-fpm.d/www.conf具有默认configuration:
listen = 127.0.0.1:9000 user = apache group = apache
可能是权限的问题?
我已经阅读了几篇文章(例如1,2,3 ),谈论相同的错误和可能的解决scheme,并试图适用于我的情况,但不能得到它的作品,所以我需要一些帮助,从任何,我什么做错了吗?
注意:从文件中显示出来的注释行与以前不相关
更改www.conf
user = nginx group = nginx
更改fastcgi_param SCRIPT_FILENAME / scripts $ fastcgi_script_name; 成
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
并检查,你有/ var / www / html中的httacess文件。 通常这会导致这个问题