Home >Backend Development >PHP Tutorial >mac中laravel框架的public文件夹无法访问?

mac中laravel框架的public文件夹无法访问?

WBOY
WBOYOriginal
2016-06-06 20:24:242652browse

Mac环境下,用安装包直接布置的laravel,通过浏览器访问laravel文件夹,可以显示文件列表,但浏览器中不显示public文件夹,地址栏直接输入地址./laravel/public/,则会报错:
Forbidden
You don't have permission to access /~jnwb/laravel/public/ on this server.

apache中的rewrite模块已开启。
vhosts.conf配置如下

<code>ServerAdmin webmaster@dummy-host.example.com
DocumentRoot "/usr/docs/dummy-host.example.com"
ServerName dummy-host.example.com
ServerAlias www.dummy-host.example.com
ErrorLog "/private/var/log/apache2/dummy-host.example.com-error_log"
CustomLog "/private/var/log/apache2/dummy-host.example.com-access_log" common</code>

<code>ServerAdmin webmaster@dummy-host2.example.com
DocumentRoot "/usr/docs/dummy-host2.example.com"
ServerName dummy-host2.example.com
ErrorLog "/private/var/log/apache2/dummy-host2.example.com-error_log"
CustomLog "/private/var/log/apache2/dummy-host2.example.com-access_log" common</code>

求助!

回复内容:

Mac环境下,用安装包直接布置的laravel,通过浏览器访问laravel文件夹,可以显示文件列表,但浏览器中不显示public文件夹,地址栏直接输入地址./laravel/public/,则会报错:
Forbidden
You don't have permission to access /~jnwb/laravel/public/ on this server.

apache中的rewrite模块已开启。
vhosts.conf配置如下

<code>ServerAdmin webmaster@dummy-host.example.com
DocumentRoot "/usr/docs/dummy-host.example.com"
ServerName dummy-host.example.com
ServerAlias www.dummy-host.example.com
ErrorLog "/private/var/log/apache2/dummy-host.example.com-error_log"
CustomLog "/private/var/log/apache2/dummy-host.example.com-access_log" common</code>

<code>ServerAdmin webmaster@dummy-host2.example.com
DocumentRoot "/usr/docs/dummy-host2.example.com"
ServerName dummy-host2.example.com
ErrorLog "/private/var/log/apache2/dummy-host2.example.com-error_log"
CustomLog "/private/var/log/apache2/dummy-host2.example.com-access_log" common</code>

求助!

laravel默认访问public目录作为服务的根目录,你的URL中不应该出现public,例如你要访问 /public/static/css/style.css 你的URL地址就是 http://domain/static/css/style.css

难道不是权限问题?改一下文件夹的权限?

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