tp5在nginx下修改配置解决访问问题

第一:修改nginx配置

    注意:所有配置都是基于lnmp1.4的一键安装环境的

    根据自己的nginx配置,找到正确的fastcgi.conf,修改fastcgi_param参数


将默认的路径修改至自己的项目根目录的上一级,注意是上级!!!

3、lnmp nginx reload

     lnmp nginx restart

第二:执行service nginx restart命令重启nginx,发现网页报404错误,需要配置一下伪静态可以在/usr/local/nginx/conf/www.tp5.com.conf(根据实际情况而定)添加:

  1. location ~ .*\.(php|php5)?$
  2.     {
  3.         #fastcgi_pass  unix:/tmp/php-cgi.sock;
  4.         fastcgi_pass  127.0.0.1:9000;
  5.         fastcgi_index index.php;
  6.         include fastcgi.conf;
  7.     }
  8.     location / {
  9.        if (!-e $request_filename) {
  10.        rewrite  ^(.*)$  /index.php?s=/$1  last;
  11.        break;
  12.         }
  13.     }
复制代码

代码放在server{} 

第三:

scandir() has been disabled for security reasons

php错误scandir() has been disabled for security reasons

原因: 
php.ini里禁用了scandir()方法

解决: 
编辑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
  • 1

去掉scandir保存并重起php-fpm即可。

php.ini 的位置:/usr/local/php/etc/php.ini

最后执行/etc/init.d/php-fpm restart重启下

你可能感兴趣的:(tp5在nginx下修改配置解决访问问题)