华域联盟 PHP 解决tp5在nginx下修改配置访问的问题

解决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(根据实际情况而定)添加:

location ~ .*\.(php|php5)?$
  {
    #fastcgi_pass unix:/tmp/php-cgi.sock;
    fastcgi_pass 127.0.0.1:9000;
    fastcgi_index index.php;
    include fastcgi.conf;
  }
  location / {
    if (!-e $request_filename) {
    rewrite ^(.*)$ /index.php?s=/$1 last;
    break;
    }
  }

代码放在server{} 内

第三:

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

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

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

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

以上这篇解决tp5在nginx下修改配置访问的问题就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持华域联盟。

您可能感兴趣的文章:

本文由 华域联盟 原创撰写:华域联盟 » 解决tp5在nginx下修改配置访问的问题

转载请保留出处和原文链接:https://www.cnhackhy.com/65273.htm

本文来自网络,不代表华域联盟立场,转载请注明出处。

作者: sterben

发表回复

联系我们

联系我们

2551209778

在线咨询: QQ交谈

邮箱: [email protected]

工作时间:周一至周五,9:00-17:30,节假日休息

关注微信
微信扫一扫关注我们

微信扫一扫关注我们

关注微博
返回顶部