我让nginx使用arch linux。我无法添加php和fastcgi。我安装了php和php-fpm软件包。 php-fpm服务已开启。当我访问带有php扩展名的文件时,浏览器会显示nginx错误页面,并且我添加了以下nginx错误日志消息:
2013/01/02 22:39:43 [错误] 721#0:* 27 connect()失败(111:Connection拒绝)连接上游时,客户端:192.168.1.13,server:localhost,request:“ GET /index.php HTTP / 1.1“,上游:”fastcgi://127.0.0.1:9000“,主持人:”192.168.1.19“
php文件的内容似乎没什么区别。我一直无法找到php错误日志或创建自己的错误日志。我将以下内容添加到/etc/php/php.ini
:
error_log = /var/log/php_error.log
我把文件写成了可写但没有任何东西可以写。我将以下内容添加到/etc/nginx/nginx.conf
:
location ~ \.php$ {
root /usr/share/nginx/html;
fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi.conf;
}
取消注释注释行没有任何改变。注释未注释的行会将从错误页面显示的浏览器页面更改为未找到文件页面。
非常感谢任何帮助。提前谢谢。
答案 0 :(得分:1)
我明白了。我必须取消注释php-fpm.conf文件中的一行,让fastcgi在正确的端口上侦听。
答案 1 :(得分:0)
尝试将配置文件更改为:
location ~ \.php$ {
root /usr/share/nginx/html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi.conf;
}