我有一个 digital ocean 水滴,我在网站的根目录上有一个测试页面,它工作得很好,但是当我尝试连接到 laravel 项目时,它给我带来了 403 禁止错误。
基本上,如果我去:
mysite.com/
显示正常页面
如果我去:
mysite.com/public
它向我显示了 403 错误
。
我尝试使用chmod -R 755 app/storage
更改权限,甚至尝试更改整个文件夹/目录的权限,但没有任何效果。
这是错误日志的最后部分:
2014/12/22 11:13:02 [error] 14447#0: *1 directory index of "/var/www/mysite.com/public_html/" is forbidden, client: 41.150.139.252, server: mysite.com, request$
2014/12/22 11:13:07 [error] 14447#0: *2 directory index of "/var/www/mysite.com/public_html/" is forbidden, client: 41.150.139.252, server: mysite.com, request$
2014/12/22 11:15:29 [emerg] 14465#0: bind() to 0.0.0.0:80 failed (98: Address already in use)
2014/12/22 11:15:29 [emerg] 14465#0: bind() to [::]:80 failed (98: Address already in use)
2014/12/22 11:15:29 [emerg] 14465#0: bind() to 0.0.0.0:80 failed (98: Address already in use)
2014/12/22 11:15:29 [emerg] 14465#0: bind() to [::]:80 failed (98: Address already in use)
2014/12/22 11:15:29 [emerg] 14465#0: bind() to 0.0.0.0:80 failed (98: Address already in use)
2014/12/22 11:15:29 [emerg] 14465#0: bind() to [::]:80 failed (98: Address already in use)
2014/12/22 11:15:29 [emerg] 14465#0: bind() to 0.0.0.0:80 failed (98: Address already in use)
2014/12/22 11:15:29 [emerg] 14465#0: bind() to [::]:80 failed (98: Address already in use)
2014/12/22 11:15:29 [emerg] 14465#0: bind() to 0.0.0.0:80 failed (98: Address already in use)
2014/12/22 11:15:29 [emerg] 14465#0: bind() to [::]:80 failed (98: Address already in use)
2014/12/22 11:15:29 [emerg] 14465#0: still could not bind()
2014/12/22 11:16:14 [error] 14447#0: *3 directory index of "/var/www/mysite.com/public_html/" is forbidden, client: 41.150.139.252, server: mysite.com, request$
最佳答案
根据您在评论中的回复,我认为东西在哪里和您期望它在哪里之间存在脱节。
你说:“目录是/var/www/mysite.com
,laravel直接安装在那里”
所以我期待这样的事情:
/var/www/mysite.com/
app/
public/
vendor/
etc...
然后你说:“[webserver]根目录设置为/var/www/mysite.com/public_html/
”
因此,当您在浏览器中访问 mysite.com
时,它会指向 /var/www/mysite.com/public_html/
和 mysite.com。 com/public
指向 /var/www/mysite.com/public_html/public/
,这似乎不是您想要的。
尝试更改 Web 服务器根目录以指向 /var/www/mysite.com/public/
(Laravel 的“公共(public)”目录)。
关于php - laravel 项目上出现 403 Forbidden,但没有其他内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27607960/