关于LNMP 环境open_basedir restriction in effect报错问题

关于LNMP 环境open_basedir restriction in effect报错问题

问题背景

在lnmp环境中,需要操作/data/log/walle/目录,但是提示报错没有权限。

解决方法

nginx

fastcgi_param PHP_ADMIN_VALUE "open_basedir=document_root/:/tmp/:/proc/";

修改为

fastcgi_param PHP_ADMIN_VALUE "open_basedir=/data/log/walle/:$document_root/:/tmp/:/proc/";

php

打开注释添加你要访问的文件夹路径

open_basedir = /data/log/walle/:/tmp/:/proc/

产生原因

因为nginx和php缺省配置了目录限定,为了安全考虑,当前www用户是无法跨目录操作的。

文章作者 明哥
文章地址 https://www.pvcreate.com/index.php/archives/47/
创建时间 2017-06-18
关注订阅 微信订阅号
开源项目 https://gitee.com/lookingdreamer
工具市场 https://gitee.com/lookingdreamer/SPPPOTools
lnmp