centos-rhel服务器相关 / 未分类 · 2014年4月2日

php写错导致nginx 403 forbidden及分析过程

配置好一个lnmp 环境,访问html页面没有问题 但是访问php文件不行,完成没有反应呢 也没报错,
查看php log没什么的
那么剩下的就是查看nginx log 了
重新访问一下php页面再查看 nginx log 如下
2014/04/02 07:53:59 [error] 1226#0: *25 FastCGI sent in stderr: “PHP message: PHP Parse error: syntax error, unexpected T_STRING, expecting ‘,’ or ‘;’ in /data/www/a.com/i.php on line 2” while reading response header from upstream, client: 192.168.1.36, server: a.com, request: “GET /i.php HTTP/1.1”, upstream: “fastcgi://127.0.0.1:10081”, host: “a.com”
看来没有 syntax error 语法错误哦
原来我写得不对

加上 ”就好了
说得好 得常常看log
下面的参考和我的情况完成不是一回事 不过也可以收集一下的
nginx 403 forbidden 二种原因
http://blog.51yip.com/apachenginx/1512.html