V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
Okra
V2EX  ›  问与答

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

  •  
  •   Okra · 2016-03-20 18:58:27 +08:00 · 1968 次点击
    这是一个创建于 2986 天前的主题,其中的信息可能已经有所发展或是发生改变。
    是这样的,我今天下午想在虚拟机 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;
    #}
    }

    求大家帮帮我!
    3 条回复    2016-03-20 20:39:10 +08:00
    yylzcom
        1
    yylzcom  
       2016-03-20 20:35:47 +08:00 via Android
    自动被注释掉?好神奇
    chairuosen
        2
    chairuosen  
       2016-03-20 20:36:41 +08:00 via iPhone
    hellojinjie
        3
    hellojinjie  
       2016-03-20 20:39:10 +08:00
    看看 ss -lnt
    确认下 php-fpm 是不是真的起来了
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   3029 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 41ms · UTC 11:03 · PVG 19:03 · LAX 04:03 · JFK 07:03
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.