所有问题解决方案
我们都已亲身测试

Nginx+PHP 站点“Access denied.”中.user.ini出坑记

网站从LNMP环境迁移到DNMP环境,访问网站时直接显示“Access denied”

其它默认站点访问文件及.php均正常,反复检查目录及用户权限均正常。

查看nginx错误日志中,发现如下错误信息:

[error] 102#102: *103 FastCGI sent in stderr: “PHP message: PHP Warning: Unknown: open_basedir restriction in effect. File(/www/www.xxx.com/wp-admin/index.php) is not within the allowed path(s): (/home/wwwroot/www.xxx.com:/tmp/:/proc/) in Unknown on line 0PHP message: PHP Warning: Unknown: failed to open stream: Operation not permitted in Unknown on line 0Unable to open primary script: /www/www.xxx.com/wp-admin/index.php (Permission denied)” while reading response header from upstream, client: 219.137.64.4, server: www.xxx.com, request: “GET /wp-admin/ HTTP/1.1”, upstream: “fastcgi://172.19.0.3:9000”, host: “www.xxx.com”

修改php.ini中的basedir参数后重启也不见效,折腾一翻后,发现站点目录下.user.ini(防跨目录)
于是打开文件发现里面的路径还是原来旧机器的!=_=,于是修改成当前正常的路径,重启Docker后解决问题!

chattr -i .user.ini
vi .user.ini
chattr +i .user.ini

🙂

赞(2)
未经允许不得转载:无忧解决网 » Nginx+PHP 站点“Access denied.”中.user.ini出坑记
分享到: 更多 (0)

评论 抢沙发

评论前必须登录!