我已经用 php5-fpm 设置了一个 nginx 服务器。当我尝试加载网站时,我得到一个没有错误的空白页面。Html 页面服务很好,但不是 php。我尝试在 php.ini 中打开 display_errors 但没有运气。php5-fpm.log 没有产生任何错误,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 错误日志:
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扩展名的文件:
location
.php
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 用户存在并且可以读取它。
/path/to/fastcgi_params