根据 ThinkPHP 的默认配置,index.php
入口文件本应在 public/index.php
的,但是 Cloudreve 直接将它移动到程序根目录,ThinkPHP 框架 的所有文件都暴露在公网下,如果 ThinkPHP
出现什么漏洞,攻击者可以直接对其进行攻击
为了避免这种,我想到了两种方法
一种是使用 Nginx URL重写(伪静态)进行屏蔽:
这里屏蔽掉了 ThinkPHP 核心文件及一些安装文件,保证其不会暴露在公网中
location ~ ^/(extend|application|thinkphp|CloudreveInstaller|vendor|extend)/*.*$
{
return 404;
}
location ~ ^/(\.user.ini|\.htaccess|\.git|\.svn|\.project|LICENSE|README.md|composer.lock|mysql.sql|deploy.sh|composer.json)
{
return 404;
}
另一种是将 index.php 移动到 public 下
这个移动之后有许多地方需要更改,我嫌麻烦,没去弄
希望官方日后能够考虑下这个问题
Comment by https://nowtime.cc/