Sij*_*rai 6 php apache heroku laravel-5.4
我在Heroku上部署了我的laravel 5.4应用程序.问题是,我收到此错误消息:
禁止您无权访问此服务器上的/
我的Procfile:
web: vendor/bin/heroku-php-apache2 public/
Run Code Online (Sandbox Code Playgroud)
查看日志,我发现它一直在尝试'app /'而不是'/'.
为了便于阅读,我的日志被剪断了.
2017-12-03T14:18:45.747195+00:00 app[web.1]: [Sun Dec 03 14:18:45.746749 2017] [autoindex:error] [pid 122:tid 140692458305280] [client 10.140.221.43:41026] AH01276: Cannot serve directory /app/: No matching DirectoryIndex (index.php,index.html,index.htm) found, and server-generated directory index forbidden by Options directive
Run Code Online (Sandbox Code Playgroud)
我的.htaccess:
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
# Handle Authorization Header
RewriteC
Run Code Online (Sandbox Code Playgroud)
我无法弄清楚我可能会说它来调查'app /'而不是'/'.如果这是导致此错误的原因.
Pil*_*ila 13
我不知道为什么服务器认为你的root是在,/app但是由于public/Heroku应该为你的应用程序提供服务的目录的权限,会发生这个错误.
要解决此问题,只需将以下内容添加到script您的部分即可composer.json
"post-install-cmd": [
"php artisan clear-compiled",
"chmod -R 777 public/"
]
Run Code Online (Sandbox Code Playgroud)
请注意public/目录权限的更改.
编辑:
当你在它的时候,检查你的Procfile确保拼写正确并以大写字母开头P.
PS:我知道有些人真的很挑剔,并且会说许可太松懈了.是的,我同意你的看法.你可以将它改成其他东西,比如775让我们只是让果汁流动.
Mik*_*yan 10
在 Laravel Root 文件夹中,创建一个名为 Procfile 的文件。
在 Procfile 中写入以下行。
web: vendor/bin/heroku-php-nginx public/
Run Code Online (Sandbox Code Playgroud)
然后再次部署它!Src 和更多在这里https://appdividend.com/2018/04/17/how-to-deploy-laravel-project-on-heroku/
希望这有帮助 =)
小智 6
解决步骤:
将您的项目克隆到您的 PC: heroku git:clone -a your-app-name
创建文件名:Procfile
然后将以下代码行保存在此Procfile中: web: vendor/bin/heroku-php-apache2 public/
使用 commed 将项目部署回 heroku:
$ git add .
$ git commit -am "make it better"
$ git push heroku master
我希望现在运行你的 Laravel 应用程序没有问题!
| 归档时间: |
|
| 查看次数: |
17157 次 |
| 最近记录: |