带有Heroku的Laravel 5:“/”路线返回403 Forbidden

时间:2015-05-12 13:25:58

标签: laravel heroku nginx laravel-5

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

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

在我推送到Heroku之后,我得到以下屏幕:

enter image description here

鉴于我对Linux的经验,我确信它必须对权限做一些事情,所以我一点一点地递归地测试文件夹上的chmod 777,并且在某些时候最终在整个项目上做了777,不用说,它不起作用。

有什么想法吗?

编辑:根据Laravel 5 docs

,这是我的nginx.conf
location / {
 try_files $uri $uri/ /index.php?$query_string;
}

1 个答案:

答案 0 :(得分:3)

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

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

所以现在你的问题是你的重写可能正常工作(尝试像/foobar这样的网址),而不是/,因为try_files指令有效(文件夹{{1存在),但不允许索引,因此403。

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

/

这应该可以解决问题。

相关问题