lnmp环境搭建错误集合

错误1:

  页面显示:No input file specified

  nginx错误日志:FastCGI sent in stderr: "PHP message: PHP Warning:  Unknown: open_basedir restriction in effect. File(/data/wwwroot/Luo/public/index.php) is not within the allowed path(s): (/home/wwwroot/default/:/tmp/:/proc/) in Unknown on line 0

  这是由于网站的目录没有权限访问,修改php的配置文件:

  修改php.ini    open_basedir=/home/wwwroot/default/:/tmp/:/proc/:/data/wwwroot/
  然后重启 php-fpm 就可以了

错误2:

  Warning: scandir() has been disabled for security reasons in /data/wwwroot/

  打开php.ini配置文件,找到这一项:disable_functions = scandir,passthru,exec,system,chroot,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_alter,ini_restore,dl,pfsockopen,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,fsocket,fsockopen

  去掉里面的scandir 然后保存,重启php-fpm

错误3:

  502 Bad gateway

  这个原因一般是由于nginx和php配置不一致,nginx和php关联的方式有两种:一种是tcp  也就是http://127.0.0.1:9000进行代理处理php文件;第二种是套接字方式unix:/tmp/php-cgi.sock;

  nginx 和php 采用tcp方式:

    nginx.conf配置:fastcgi_pass   127.0.0.1:9000;

    php-fpm.conf配置:listen = 127.0.0.1:9000

  nginx和php采用套接字:

    nginx.conf配置:fastcgi_pass unix:/tmp/php-cgi.sock;

    php-fpm.conf配置:listen = /tmp/php-cgi.sock

  修改两边配置文件为同一种方式,然后重启php-fpm,重启nginx 

原文地址:https://www.cnblogs.com/myIvan/p/9861070.html