Laravel 5 与 Heroku: "/" route returns 403 Forbidden

Laravel 5 with Heroku: "/" route returns 403 Forbidden

正如标题所说,我正在使用 Heroku 和以下 Procfile:

web: vendor/bin/heroku-php-nginx -C nginx.conf public/

推送到 Heroku 后,我看到以下屏幕:

根据我在 Linux 方面的经验,我确信它必须对权限做一些事情,所以我一点一点地递归地在文件夹上测试了 chmoding 777,并且在某个时候最终对整个文件夹执行了 777项目,不用说了,没成功

有什么想法吗?

编辑: 这是我的 nginx.conf 根据 Laravel 5 docs

location / {
 try_files $uri $uri/ /index.php?$query_string;
}

使用 -C 开关,您将覆盖默认的 Nginx 配置 "include snippet",其中还包含:

location / {
    index  index.php index.html index.htm;
}

所以你现在的问题是你的重写可能工作得很好(尝试 URL 就像 /foobar),而不是 /,因为 try_files 指令有效(文件夹 / 存在),但不允许使用索引,因此出现 403.

解决这个问题的最简单方法是添加索引指令:

location / {
    index index.php;
    try_files $uri $uri/ /index.php?$query_string;
}

这应该可以解决问题。