您的位置:首页 > 运维架构 > Nginx

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

2019-10-16 18:07 2311 查看

第一:修改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 配置 访问
相关文章推荐