欢迎来到代码驿站!

PHP代码

当前位置:首页 > 软件编程 > PHP代码

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

时间:2021-05-17 08:41:12|栏目:PHP代码|点击:

第一:修改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重启下

上一篇:php中preg_replace_callback函数简单用法示例

栏    目:PHP代码

下一篇:PHP使用strtotime计算两个给定日期之间天数的方法

本文标题:解决tp5在nginx下修改配置访问的问题

本文地址:http://www.codeinn.net/misctech/123264.html

推荐教程

广告投放 | 联系我们 | 版权申明

重要申明:本站所有的文章、图片、评论等,均由网友发表或上传并维护或收集自网络,属个人行为,与本站立场无关。

如果侵犯了您的权利,请与我们联系,我们将在24小时内进行处理、任何非本站因素导致的法律后果,本站均不负任何责任。

联系QQ:914707363 | 邮箱:codeinn#126.com(#换成@)

Copyright © 2020 代码驿站 版权所有