我试着在谷歌搜索引擎中输入我网站的域名,震惊地意识到不应该公开的应用程序文件夹已经被索引了。文件夹和文件类似于composer.json,供应商目录、存储目录、资源目录等等。
我如何设置:
应用程序位于public_html目录中,index.php是入口点,位于根目录(Public_html)中。其他Laravel应用程序目录保持不变(默认的Laravel 7目录结构)
发布于 2021-09-21 07:05:22
应用程序位于public_html目录中,index.php是入口点,位于根目录(Public_html)中。其他Laravel应用程序目录保持不变(默认的Laravel 7目录结构)
在默认的Laravel安装中,项目目录中没有index.php,只有server.php。
唯一应该公开访问的Laravel目录是public。
您正在使用Apache,这意味着应该将DocumentRoot设置为/path/to/your/project/public (其中public是Laravel的public目录)。
这上面的将是不可访问的。
发布于 2021-09-21 07:13:33
您应该将所有项目文件移动到根目录,然后将文件从public复制到public_html,然后指向Laravel中的public_html:
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
public function register()
{
$this->app->bind('path.public', function() {
return base_path().'/public_http';
});
}你也可以看到:How to change public folder to public_html in laravel 5
https://stackoverflow.com/questions/69264450
复制相似问题