我已经在 heroku 上成功部署了一个 laravel 6.2 应用程序并且它工作正常,直到我尝试访问除主登录页面之外的任何其他路线。
我的日志(为便于阅读而截取):
2020-01-04T04:54:17.512849+00:00 heroku[路由器]: at=info method=GET path="/service" host=ridgearchitectsandengineers.herokuapp.com request_id=261880df-693e-4dda-85e5-5a20720a21fd fwd= “110.44.124.147” dyno=web.1 connect=0ms service=1ms status=404 bytes=691 protocol=https 2020-01-04T04:54:17.513095+00:00 app[web.1]: 2020/01/04 04:54:17 [错误] 145#0: *131 open() "/app/public/service" 失败(2:没有这样的文件或目录),客户端:10.81.170.215,服务器:localhost,请求:“GET /service HTTP/1.1”,主机:“ridgearchitectsandengineers.herokuapp.com”,引用者:“ https://ridgearchitectsandengineers.herokuapp.com/ ” 2020-01-04T04:54:17.516131+00:00 app[web.1] : 10.81.170.215 - - [04/Jan/2020:04:54:17 +0000] "GET /service HTTP/1.1" 404 548 "https://ridgearchitectsandengineers.herokuapp.com/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36
不过,这些路线在我的本地机器上运行良好。如果相关,我也会将我的 Procfile 放入:
网站:供应商/bin/heroku-php-nginx public/
我的 .htaccess :
选项 -MultiViews -Indexes
RewriteEngine On
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]