nginx open_basedir restriction in effect is not within the allowed path(s) 解决办法

2020/05/03 13:42:17 [error] 26592#0: *102733 FastCGI sent in stderr: "PHP message: PHP Warning:  require(): open_basedir restriction in effect\
. File(/workspace/yoshop/bestshop-php/source/thinkphp/start.php) is not within the allowed path(s): (/workspace/yoshop/bestshop-php/web/:/tmp/\
:/proc/) in /workspace/yoshop/bestshop-php/web/index.php on line 12PHP message: PHP Warning:  require(/workspace/yoshop/bestshop-php/source/th\
inkphp/start.php): failed to open stream: Operation not permitted in /workspace/yoshop/bestshop-php/web/index.php on line 12PHP message: PHP F\
atal error:  require(): Failed opening required '/workspace/yoshop/bestshop-php/web/../source/application/../thinkphp/start.php' (include_path\
='.:/usr/local/php/lib/php') in /workspace/yoshop/bestshop-php/web/index.php on line 12" while reading response header from upstream, client: \
222.35.130.161, server: yoshop.cn, request: "GET / HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "yoshop.cn:8020"
 

配置nginx.conf之后报错500:

因为fastcgi设置的引入文件路径限制:

/usr/local/nginx/conf/fastcgi.conf

最后一行修改:

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

改为:

fastcgi_param PHP_ADMIN_VALUE "open_basedir=$document_root/:/tmp/:/proc/:/workspace/yoshop/bestshop-php";

即可

web发布路径的上一级目录

nginx open_basedir restriction in effect is not within the allowed path(s) 解决办法

 

mysql 创建用户:

nginx open_basedir restriction in effect is not within the allowed path(s) 解决办法