Laravel nginx.conf与官方Heroku php buildpack?

cac*_*one 2 nginx heroku laravel

我在项目根目录中的`nginx.conf中有以下内容

location / {
       try_files $uri $uri/ /index.php?$query_string;
}
Run Code Online (Sandbox Code Playgroud)

但只有在/路径工作中,所有其他人都会遇到404错误.

如何使用nginx使Laravel在heroku上运行?

cac*_*one 10

这最终为我工作:Procfile:

web: vendor/bin/heroku-php-nginx -C nginx.conf public/
Run Code Online (Sandbox Code Playgroud)

nginx.conf

location / {
    # try to serve file directly, fallback to rewrite
    try_files $uri @rewriteapp;
}

location @rewriteapp {
    # rewrite all to app.php
    rewrite ^(.*)$ /index.php$1 last;
}
Run Code Online (Sandbox Code Playgroud)