Home  >  Article  >  Backend Development  >  浏览器访问laravel文件夹时页面出现该文件夹下的目录结构?

浏览器访问laravel文件夹时页面出现该文件夹下的目录结构?

WBOY
WBOYOriginal
2016-06-06 20:34:411528browse

Mac配置了PHP环境,用户级根目录是~/Sites,laravel建在该目录下,以mylaravel命名。通过链接:http://localhost/~Darren/mylaravel/public/index.php
访问能够出现laravel的欢迎首页。
但是有一个问题:如果通过链接http://localhost/~Darren/mylaravel访问就会在浏览器上显示mylaravel目录下的文件夹结构,这个很不安全吧?怎么破?

浏览器访问laravel文件夹时页面出现该文件夹下的目录结构?

回复内容:

Mac配置了PHP环境,用户级根目录是~/Sites,laravel建在该目录下,以mylaravel命名。通过链接:http://localhost/~Darren/mylaravel/public/index.php
访问能够出现laravel的欢迎首页。
但是有一个问题:如果通过链接http://localhost/~Darren/mylaravel访问就会在浏览器上显示mylaravel目录下的文件夹结构,这个很不安全吧?怎么破?

浏览器访问laravel文件夹时页面出现该文件夹下的目录结构?

问题已经解决:将用户级的web根目录在apache的httpd.conf文件中配置到:http://localhost/~darren/mylaravel/public即可。

解决方案来源:Architecture of Laravel Applications

其中有一段解释:

浏览器访问laravel文件夹时页面出现该文件夹下的目录结构?
意思是:public文件夹必须指引到服务器的web访问根目录。

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn