首页 >后端开发 >php教程 >mac中laravel框架的public文件夹无法访问?

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

WBOY
WBOY原创
2016-06-06 20:24:242655浏览

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

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

声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn