VPS侦探论坛

 找回密码
 注册
查看: 3782|回复: 4

lnmp1.5部署站点之后出现500

[复制链接]
发表于 2019-5-21 10:02:52 | 显示全部楼层 |阅读模式

框架 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 [error] 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 [error] 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的错误日志
请问这是什么情况?


美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
发表于 2019-5-21 13:14:53 | 显示全部楼层


按常见问题说明移除防跨目录设置
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
 楼主| 发表于 2019-5-21 15:38:49 | 显示全部楼层

问题已解决,感谢!
解决方案:
如果你是PHP 5.3.3以上的版本,可以修改/usr/local/php/etc/php.ini在末尾里加入:

[HOST=www.vpser.net] open_basedir=/home/wwwroot/www.vpser.net/:/tmp/
[PATH=/home/wwwroot/www.vpser.net] open_basedir=/home/wwwroot/www.vpser.net/:/tmp/
按上面的这个例子修改,换成你自己的域名和目录,多个网站就按上面的例子改成多个,
最后重启php-fpm:     /etc/init.d/php-fpm restart
最好也重启下nginx      /etc/init.d/nginx restart
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
发表于 2019-5-21 18:22:25 | 显示全部楼层



dddzzzjjj 发表于 2019-5-21 15:38
问题已解决,感谢!
解决方案:
如果你是PHP 5.3.3以上的版本,可以修改/usr/local/php/etc/php.ini在末尾 ...

你这不属于正规的解决方法,不推荐任何用户使用,常见问题有具体修改防跨目录设置的方法
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
发表于 2019-5-25 22:30:39 | 显示全部楼层

dddzzzjjj 发表于 2019-5-21 15:38
问题已解决,感谢!
解决方案:
如果你是PHP 5.3.3以上的版本,可以修改/usr/local/php/etc/php.ini在末尾 ...

听军哥的不会错!

军哥运维代购:http://shop63846532.taobao.com/

您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|Archiver|VPS侦探 ( 鲁ICP备16040043号-1 )

GMT+8, 2024-11-20 09:21 , Processed in 0.026337 second(s), 16 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表