I have the following in `nginx.conf in my project root
location / {
try_files $uri $uri/ /index.php?$query_string;
}
But only in the /
path works, all others are coming up with a 404 error.
How can I make Laravel work on heroku with nginx?
This ended up working for me: Procfile:
web: vendor/bin/heroku-php-nginx -C nginx.conf public/
nginx.conf
location / {
# try to serve file directly, fallback to rewrite
try_files $uri @rewriteapp;
}
location @rewriteapp {
# rewrite all to app.php
rewrite ^(.*)$ /index.php$1 last;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With