lnmp1.5部署站点之后出现500
框架 ThinkPHP5.0用的是lnmp1.5
这是我的nginx站点配置
server
{
listen 80;
#listen [::]:80;
server_name k2.****.com ;
index index.html index.htm index.php default.html default.htm default.php;
root/home/wwwroot/lzydoudoumall/public;
include rewrite/thinkphp.conf;
#error_page 404 /404.html;
# Deny access to PHP files in specific directory
#location ~ /(wp-content|uploads|wp-includes|images)/.*\.php$ { deny all; }
include enable-php-pathinfo.conf;
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 12h;
}
location ~ /.well-known {
allow all;
}
location ~ /\.
{
deny all;
}
access_log/home/wwwlogs/k2.****.com.log;
error_log/home/wwwlogs/k2.****.comerror.log;
}
部署之后出现500
我查看了错误日志显示
2019/05/20 16:03:18 2793#0: *5455 FastCGI sent in stderr: "PHP message: PHP Warning:require(): open_basedir restriction in effect. File(/home/wwwroot/lzydoudoumall/thinkphp/base.php) is not within the allowed path(s): (/home/wwwroot/lzydoudoumall/public/:/tmp/:/proc/) in /home/wwwroot/lzydoudoumall/public/index.php on line 23
PHP message: PHP Warning:require(/home/wwwroot/lzydoudoumall/thinkphp/base.php): failed to open stream: Operation not permitted in /home/wwwroot/lzydoudoumall/public/index.php on line 23
PHP message: PHP Fatal error:require(): Failed opening required '/home/wwwroot/lzydoudoumall/public/../thinkphp/base.php' (include_path='.:/usr/local/php/lib/php') in /home/wwwroot/lzydoudoumall/public/index.php on line 23" while reading response header from upstream, client: 14.223.93.57, server: k2.vipc800.com, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/tmp/php-cgi.sock:", host: "k2.vipc800.com"
2019/05/21 09:52:33 2793#0: *6063 FastCGI sent in stderr: "PHP message: PHP Warning:require(): open_basedir restriction in effect. File(/home/wwwroot/lzydoudoumall/thinkphp/base.php) is not within the allowed path(s): (/home/wwwroot/lzydoudoumall/public/:/tmp/:/proc/) in /home/wwwroot/lzydoudoumall/public/index.php on line 23
PHP message: PHP Warning:require(/home/wwwroot/lzydoudoumall/thinkphp/base.php): failed to open stream: Operation not permitted in /home/wwwroot/lzydoudoumall/public/index.php on line 23
PHP message: PHP Fatal error:require(): Failed opening required '/home/wwwroot/lzydoudoumall/public/../thinkphp/base.php' (include_path='.:/usr/local/php/lib/php') in /home/wwwroot/lzydoudoumall/public/index.php on line 23" while reading response header from upstream, client: 14.223.93.57, server: k2.vipc800.com, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/tmp/php-cgi.sock:", host: "k2.vipc800.com"
这是nginx的错误日志
请问这是什么情况?
按常见问题说明移除防跨目录设置 问题已解决,感谢!
解决方案:
如果你是PHP 5.3.3以上的版本,可以修改/usr/local/php/etc/php.ini在末尾里加入:
open_basedir=/home/wwwroot/www.vpser.net/:/tmp/
open_basedir=/home/wwwroot/www.vpser.net/:/tmp/
按上面的这个例子修改,换成你自己的域名和目录,多个网站就按上面的例子改成多个,
最后重启php-fpm: /etc/init.d/php-fpm restart
最好也重启下nginx /etc/init.d/nginx restart dddzzzjjj 发表于 2019-5-21 15:38
问题已解决,感谢!
解决方案:
如果你是PHP 5.3.3以上的版本,可以修改/usr/local/php/etc/php.ini在末尾 ...
你这不属于正规的解决方法,不推荐任何用户使用,常见问题有具体修改防跨目录设置的方法 dddzzzjjj 发表于 2019-5-21 15:38
问题已解决,感谢!
解决方案:
如果你是PHP 5.3.3以上的版本,可以修改/usr/local/php/etc/php.ini在末尾 ...
听军哥的不会错!
页:
[1]