初步解决上传 Heroku 后,Laravel 路由不生效问题
/Procfile
web: vendor/bin/heroku-php-nginx -C nginx_app.conf public/
/nginx_app.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;
}
location ~ ^/(app|app_dev|config)\.php(/|$) {
try_files @heroku-fcgi @heroku-fcgi;
internal;
}
参照 heroku 官网,把官网中的 rewrite ^(.)$ /app.php/$1 last; 替换成 rewrite ^(.)$ /index.php/$1 last;
推荐文章: