Search code examples
phpherokuprocfile

Deploying Sylius on Heroku - Routing not correct


I am trying to deploy Sylius to Heroku. I have had many attempts but all have been unsuccessful.

I am following this guide: https://dev.to/aaahmedaa/deploy-sylius-to-heroku-55p1

This is the repo I am trying to deploy: https://github.com/ivantxo/creativedss2

The Heroku activity log seems fine and the app is deployed.

But when I visit the app URL I see this: enter image description here

The logs show me this:

2023-08-18T20:51:38.659916+00:00 heroku[router]: at=info method=GET path="/en_US/" host=creativedss-6e8e6463e6bc.herokuapp.com request_id=784e6ab0-8e79-4ac2-8dc3-7dbae6506bd6 fwd="110.174.122.237" dyno=web.1 connect=0ms service=23ms status=500 bytes=1204 protocol=https
2023-08-18T20:51:38.661457+00:00 app[web.1]: 10.1.43.231 - - [18/Aug/2023:20:51:38 +0000] "GET /en_US/ HTTP/1.1" 500 1027 "https://dashboard.heroku.com/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36

My Procfile has: web: heroku-php-nginx -C nginx_app.conf public/

and my nginx_app.conf has:

location / {
    # try to serve file directly, fallback to rewrite
    try_files $uri @rewriteapp;
}

location @rewriteapp {
    # rewrite all to index.php
    rewrite ^(.*)$ /index.php/$1 last;
}

location ~ ^/index\.php(/|$) {
    try_files @heroku-fcgi @heroku-fcgi;
    # ensure that /index.php isn't accessible directly, but only through a rewrite
internal;
}

Any idea please? Any help is appreciated.

Thanks


Solution

  • For HTTP status 500 in PHP context you also need to look into the PHP error log, Nginx error log only tells you that a 500 happened and not why (in this case).

    Therefore check the PHP error log and add the related parts from it to your question.

    It then should become visible if it's solvable with the Nginx configuration, the Heroku configuration or the PHP configuration (including all the source code that did throw/error).