Symfony deployment on heroku points to app folder
Asked Answered
N

2

1

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.

So using the command heroku logs --num 10 i can see the error

Cannot serve directory /app/web/: No matching DirectoryIndex (index.php,index.html,index.htm) found, and server-generated directory index forbidden by Options directive

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.

So how can i get rid of this app? I do not understand why Heroku is even pointing at that.

I have gone through the steps mentioned in Symfony documentation over and over and I cant seem to find out what I am missing?

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.

Symfony on Heroku: 403 Forbidden You don't have permission to access / on this server

Any help will be really appreciated.

Neolith answered 14/12, 2016 at 19:42 Comment(0)
N
2

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.

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.

After making sure of the above two steps my app works perfectly fine on Heroku.

Neolith answered 21/12, 2016 at 5:32 Comment(0)
L
1

Use /web/ instead of web/: add the leading slash!

Your Procfile file should contain this:

web: vendor/bin/heroku-php-apache2 /web/

Note the leading / in the path to the web folder!

Litotes answered 15/12, 2016 at 12:26 Comment(1)
Thanks @Litotes unfortunately that did not help :) I did end up fixing it by adding 'app.json' in the root devcenter.heroku.com/articles/app-json-schema I will add the answer in a while. I do very much appreciate you having a look.Neolith

© 2022 - 2024 — McMap. All rights reserved.