heroku上的Symfony部署指向应用程序文件夹 [英] Symfony deployment on heroku points to app folder
问题描述
我试图在heroku上部署symfony应用程序,并且我能够更新模式,并且完全正常,但是当我尝试访问我获得的网站时
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
禁止
您没有权限访问此服务器。
Forbidden You don't have permission to access / on this server.
命令 heroku日志--num 10
我可以看到错误
无法投放目录/ app / web /:找不到匹配的DirectoryIndex
(index.php,index.html,index.htm),以及服务器生成的目录
通过Options指令禁止的索引
Cannot serve directory /app/web/: No matching DirectoryIndex (index.php,index.html,index.htm) found, and server-generated directory index forbidden by Options directive
正如您所看到的,heroku正在尝试访问 / app / web /
,而不仅仅是 web
,因为这甚至我的资产正在通过 app / web / css
访问,这是错误的。
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.
那么我该如何摆脱这个 app
?我不明白为什么Heroku甚至指出这一点。
So how can i get rid of this app
? I do not understand why Heroku is even pointing at that.
我已经完成了 Symfony文档一遍又一遍,我似乎无法找到我失踪?
I have gone through the steps mentioned in Symfony documentation over and over and I cant seem to find out what I am missing?
Procfile似乎指向web,所以这是 app
来自哪里?
The Procfile seems to be point to web so where is this app
coming from?
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.
Heroku上的Symfony:403 Forbidden您无权访问/在此服务器上
任何帮助都会得到真正的赞赏。
Any help will be really appreciated.
推荐答案
需要创建 .Pro cfile
并上传或创建 app.json
纲要文件,然后基于Heroku自动为你创建 .Procfile
,此处可以看到 app.json
Symfony应用程序示例
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.
需要检查的另一件事是确保在您的公共目录中 .htaccess
文件也被上传了。在Symfony中,公共目录是 web
文件夹,在我的情况下,缺少 .htaccess
文件。
Another thing that needs to be crossed checked is make sure in your public directory the .htaccess
file was also uploaded. In Symfony the public directory is the web
folder and in my case the .htaccess
file was missing.
在确定上述两个步骤后,我的应用程序在Heroku上完美运行。
After making sure of the above two steps my app works perfectly fine on Heroku.
这篇关于heroku上的Symfony部署指向应用程序文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!