php - laravel 5 heroku 404 not found ngix -
i'm getting pretty weird error while trying deploy laravel 5 application heroku. if try access root domain https://my-app.herokuapp.com
works fine. however, if try access , other domain /
aka https://my-app.herokuapp.com/api/v1/users
gives me 404 not found. heroku trying go folder /api/v1/users instead of reading routes file.
here procfile:
web: vendor/bin/heroku-php-nginx public/
now if try same thing apache server works fine:
web: vendor/bin/heroku-php-apache2 public/
https://devcenter.heroku.com/articles/custom-php-settings
using custom application level nginx configuration
inside default server level configuration file heroku uses during startup of nginx, includes simple default application level config file. can replace file custom configuration. example, configure nginx use rewrite rules symfony2 application, you’d create nginx_app.conf inside application’s root directory following contents:
location / { # try serve file directly, fallback rewrite try_files $uri @rewriteapp; } location @rewriteapp { # rewrite app.php rewrite ^(.*)$ /app.php/$1 last; } location ~ ^/(app|app_dev|config)\.php(/|$) { try_files @heroku-fcgi @heroku-fcgi; internal; }
for laravel.
create in root directory nginx_app.conf:
location / { # try serve file directly, fallback rewrite try_files $uri @rewriteapp; } location @rewriteapp { # rewrite app.php rewrite ^(.*)$ /index.php/$1 last; } location ~ ^/(app|app_dev|config)\.php(/|$) { try_files @heroku-fcgi @heroku-fcgi; internal; }
in procfile:
web: vendor/bin/heroku-php-nginx -c nginx_app.conf /public
Comments
Post a Comment