[英]Symfony deployment on heroku points to app folder
I am trying to deploy the symfony app on heroku and I am able to update the schema and all perfectly fine however when i try to access the site I get 我正在尝试在heroku上部署symfony应用程序,并且能够更新架构,但一切都很好,但是当我尝试访问该站点时,我得到了
Forbidden You don't have permission to access / on this server.
禁止您无权访问此服务器上的/。
So using the command heroku logs --num 10
i can see the error 所以使用命令
heroku logs --num 10
我可以看到错误
Cannot serve directory /app/web/: No matching DirectoryIndex (index.php,index.html,index.htm) found, and server-generated directory index forbidden by Options directive
无法提供目录/ app / web /:找不到匹配的DirectoryIndex(index.php,index.html,index.htm),并且服务器生成的目录索引被Options指令禁止
As you can see heroku is trying to access /app/web/
rather than just web
, because of this even my assets are being access via app/web/css
which is ofcourse wrong. 如您所见,heroku尝试访问
/app/web/
而不是仅访问web
,因此,即使我的资产也正在通过app/web/css
访问,这当然是错误的。
So how can i get rid of this app
? 那么我该如何摆脱这个
app
呢? I do not understand why Heroku is even pointing at that. 我不明白为什么Heroku甚至指向那个。
I have gone through the steps mentioned in Symfony documentation over and over and I cant seem to find out what I am missing? 我已经一遍又一遍地完成了Symfony文档中提到的步骤,但似乎找不到我想念的东西?
The Procfile seems to be point to web so where is this app
coming from? Procfile似乎指向Web,所以此
app
来自哪里?
web: vendor/bin/heroku-php-apache2 web/
I have gone through other articles online like the one as following but nothing seems to be fixing my problem. 我在网上浏览了其他文章,如下所示,但似乎没有什么可以解决我的问题。
Symfony on Heroku: 403 Forbidden You don't have permission to access / on this server Heroku上的Symfony:禁止的403您无权访问此服务器上的/
Any help will be really appreciated. 任何帮助将不胜感激。
On Heroku you need to create the .Procfile
and upload that or create the app.json
Schema file and then based on that Heroku will create the .Procfile
for you automatically, here you can see the app.json
example for Symfony app. 在Heroku上,您需要创建
.Procfile
并上传该文件 或创建app.json
Schema文件 ,然后基于此Heroku将自动为您创建.Procfile
, 在这里您可以看到Symfony应用的app.json
示例。
Another thing that needs to be crossed checked is make sure in your public directory the .htaccess
file was also uploaded. 需要检查的另一件事是确保在您的公共目录中也上传了
.htaccess
文件。 In Symfony the public directory is the web
folder and in my case the .htaccess
file was missing. 在Symfony中,公共目录是
web
文件夹,在我的情况下, .htaccess
文件丢失了。
After making sure of the above two steps my app works perfectly fine on Heroku. 确定以上两个步骤后,我的应用程序在Heroku上运行正常。
Use /web/
instead of web/
: add the leading slash! 使用
/web/
而不是web/
:添加斜杠!
Your Procfile
file should contain this: 您的
Procfile
文件应包含以下内容:
web: vendor/bin/heroku-php-apache2 /web/
Note the leading /
in the path to the web
folder! 请注意
web
文件夹路径中的前导/
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.