快疯了,求大家帮帮我,看下问题出在哪里

2016-03-20 18:58:27 +08:00
 Okra
是这样的,我今天下午想在虚拟机 centos7 中配置 nginx + php + mysql 的环境,软件都装好了,能正常访问 html 页面,但是访问 php 页面的时候就是一片空白,在网页上查看源代码就是原来的 php 代码被注释掉了,下面这个样子:
<-- <? php echo phpinfo(); -->
<html>
<head></head>
<body></body>
</html>

nginx 和 php-fpm 正常运行, php-fpm 是监听 127.0.0.1:9000 端口,查看 nginx 和 php-fpm 的错误日志,访问 php 页面的时候也并没有错误日志生成。

下面是我的 nginx 配置文件:

server {
listen 80;
server_name localhost;

#charset koi8-r;
#access_log /var/log/nginx/log/host.access.log main;

location / {
root /usr/share/nginx/html;
index index.html index.htm index.php;
}

#error_page 404 /404.html;

# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}

# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}

# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#

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_params;
}

# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}

求大家帮帮我!
1984 次点击
所在节点    问与答
3 条回复
yylzcom
2016-03-20 20:35:47 +08:00
自动被注释掉?好神奇
chairuosen
2016-03-20 20:36:41 +08:00
hellojinjie
2016-03-20 20:39:10 +08:00
看看 ss -lnt
确认下 php-fpm 是不是真的起来了

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/264962

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX