php - laravel 项目上出现 403 Forbidden,但没有其他内容

标签 php laravel nginx digital-ocean

我有一个 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/

相关文章:

ssl - 为端口转发地址安装免费的 SSL https

ruby-on-rails - rvmsudo passenger-install-nginx-module : No such file or directory

PHP 数组变量传递不正确

php正则表达式反斜杠破折号

javascript - Google Sheets 作为 Ajax 数据库

php - WeBid : Timezones with daylight savings time not calculated correctly

php - 使用 {{ }} 时的 Laravel 5.6 htmlspecialchars

php - Laravel 项目的 Azure Web App 错误 404

php - 如何使用 Laravel 允许 WYSIWYG 编辑器并禁用 XSS 攻击?

nginx - 回退到 nginx 中的默认/共享文件