phpinfo无法显示

今天调试lnmp环境,出现如下报错。无法查询到php信息。

环境:linux版本CentOS Linux release 7.3.1611 (Core),nginx使用tengine。php和tengine均为源码安装到/usr/local。

首先确认tengine已经启动,在网站根目录下写了个静态测试网页,测试没问题,可以正常显示。

确认php-fpm已经启动,查询服务端口正常。怀疑tengine的php支持没有配置。打开/usr/local/tengine/conf/vhost下面的*.conf主机配置,修改以下配置:追加index.php让nginx服务器默认支持index.php为首页,同时通过注释,启用相关配置。注意$document_root的位置,可以写成$document_root,也可以写成网站根目录,但是一定不能是默认的/scripts。

location / {
            root   /var/www/html;
            index  index.html index.htm index.php;
        }
...
...
location ~ \.php$ {
            root           /var/www/html;
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
            include        fastcgi_params;
        }
...
...

同时,确保/usr/local/php/etc/php-fpm.conf的配置:

listen = 127.0.0.1:9000

然后,重启服务就可以了。

猜你喜欢

转载自blog.csdn.net/zsx0728/article/details/81183056