问题描述
我已经用php5-fpm设置了一个nginx服务器.当我尝试加载网站时,我得到一个空白页面,没有任何错误. HTML页面可以很好地服务,但不能使用PHP.我尝试在php.ini中打开display_errors,但是没有运气. php5-fpm.log不会产生任何错误,nginx也不会.
I have setup an nginx server with php5-fpm. When I try to load the site I get a blank page with no errors. Html pages are served fine but not php. I tried turning on display_errors in php.ini but no luck. php5-fpm.log is not producing any errors and neither is nginx.
nginx.conf
server {
listen 80;
root /home/mike/www/606club;
index index.php index.html;
server_name mikeglaz.com www.mikeglaz.com;
error_log /var/log/nginx/error.log;
location ~ \.php$ {
#fastcgi_pass 127.0.0.1:9000;
# With php5-fpm:
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
}
编辑
这是我的Nginx错误日志:
here's my nginx error log:
2013/03/15 03:52:55 [error] 1020#0: *55 open() "/home/mike/www/606club/robots.txt" failed (2: No such file or directory), client: 199.30.20.40, server: mikeglaz.com, request: "GET /robots.txt HTTP/1.1", host: "mikeglaz.com"
推荐答案
作为参考,我附上了我的location
块,用于捕获扩展名为.php
的文件:
For reference, I am attaching my location
block for catching files with the .php
extension:
location ~ \.php$ {
include /path/to/fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;
}
仔细检查/path/to/fastcgi-params
,并确保nginx用户可以看到并读取它.
Double-check the /path/to/fastcgi-params
, and make sure that it is present and readable by the nginx user.
这篇关于nginx显示空白的PHP页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!