Laravel 公共文件夹

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/12645538/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 07:23:20  来源:igfitidea点击:

Laravel Public Folder

phplaravel

提问by GPicazo

I was wondering if someone could shed some light as to why the index.php file for a laravel application lives in the public directory. What are the risks if I were to move it into the root directory instead?

我想知道是否有人可以解释为什么 laravel 应用程序的 index.php 文件位于公共目录中。如果我将其移动到根目录中会有什么风险?

回答by cborgia

The files and folders in laravels public folder are meant to be web accessible. For security, all other files and folders in the laravel framework should not be web accessible.

laravel 公共文件夹中的文件和文件夹是可以通过网络访问的。为了安全起见,laravel 框架中的所有其他文件和文件夹都不应通过网络访问。

Moving the index.php to laravels root will break the framework and defy best practices.

将 index.php 移动到 laravel 根目录将破坏框架并违背最佳实践。

Follow theseinstructions to ensure your servers config points to the public directory for DocumentRoot

按照这些说明确保您的服务器配置指向 DocumentRoot 的公共目录