如何保护共享服务器上的public_html文件夹?

问题描述 投票:0回答:1

我已经将laravel应用程序部署到共享主机。我的所有文件都位于public_html文件夹中,包括一个包含我的数据库凭据的.env文件。根据我在网上看到的一些文章,恶意用户可以通过某种方式访问​​public_html文件夹......这怎么可能,我该如何保护呢?

php laravel public-html
1个回答
-3
投票

在project / public / index.php中

寻找以下内容:

require __DIR__.’/../bootstrap/autoload.php’;
$app = require_once __DIR__.’/../bootstrap/app.php’;

并将它们更新为:

require __DIR__.’/../project/bootstrap/autoload.php’;
$app = require_once __DIR__.’/../project/bootstrap/app.php’;

除非您正在上载供应商目录,否则您可能会遇到运行composer的问题。

参考:https://medium.com/laravel-news/the-simple-guide-to-deploy-laravel-5-application-on-shared-hosting-1a8d0aee923e

© www.soinside.com 2019 - 2024. All rights reserved.