0

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

4

1 回答 1

-3

在项目/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

于 2017-12-22T04:01:27.147 回答