您现在的位置是:网站首页> 编程资料编程资料
解决tp5在nginx下修改配置访问的问题_php实例_
2023-05-25
510人已围观
简介 解决tp5在nginx下修改配置访问的问题_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重启下
以上这篇解决tp5在nginx下修改配置访问的问题就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持。
您可能感兴趣的文章:
相关内容
- Laravel6.2中用于用户登录的新密码确认流程详解_php实例_
- PHP实现15位身份证号转18位的方法分析_php技巧_
- laravel unique验证、确认密码confirmed验证以及密码修改验证的方法_php实例_
- 解决thinkPHP 5 nginx 部署时,只跳转首页的问题_php实例_
- 详解将数据从Laravel传送到vue的四种方式_php实例_
- 漂亮的thinkphp 跳转页封装示例_php技巧_
- Thinkphp页面跳转设置跳转等待时间的操作_php实例_
- 解决thinkphp5未定义变量会抛出异常,页面错误,请稍后再试的问题_php实例_
- thinkphp5使html5实现动态跳转的例子_php实例_
- Thinkphp5 如何隐藏入口文件index.php(URL重写)_php实例_
