Can't get any route using php and slim framework
It's a small app that I wanted to deploy. Everything works normal but when I try to get into a route I get a 404 error. I think the .htaccess file is not working like it does locally.
Works: https://slim-php-deployment-production-8419.up.railway.app/
Not: https://slim-php-deployment-production-8419.up.railway.app/test
a6ace02e-d783-426b-9daf-613e795ce691
27 Replies
Project ID:
a6ace02e-d783-426b-9daf-613e795ce691
GitHub
GitHub - AgustinFrich/slim-php-deployment: Aplicación Slim Framewor...
Aplicación Slim Framework 4 PHP con despliegue automático 🚀 - GitHub - AgustinFrich/slim-php-deployment: Aplicación Slim Framework 4 PHP con despliegue automático 🚀
an htaccess file is not applicable for the php provider on railway since it uses nginx, but you can provide your own nginx.conf, this explains a little on how you can do that
https://nixpacks.com/docs/providers/php
When I add a nginx.conf, even if it doesn't have any configurations, I get an "Application failed to respond" but doesn't crash or gives any log.
can you send your nginx config
I tried with and same output. It gives me an error if I don't put events or if it has any syntax error
please reference the nginx config file in the link I sent you
Are you talking about this?
https://github.com/railwayapp/nixpacks/blob/main/src/providers/php/nginx.template.conf
GitHub
nixpacks/nginx.template.conf at main · railwayapp/nixpacks
App source + Nix packages + Docker = Image. Contribute to railwayapp/nixpacks development by creating an account on GitHub.
yes
you'll need to modify that to redirect all requests to index.php
I've tried modifying that but the application fails to respond every time, and only works again if I delete the nginx.conf
try without modifying,
/test
wont work, but let me know if the root endpoint does at least workRoot doesn't work when I have the nginx.conf
none of the routes?
None
what status code do you get
The app doesn't crash, it is still active
what status code do you get when hitting the root route
Sorry, 503
and thats when using the unmodified config?
Exactly
Or with the empty roules, same thing
okay, i will look into it in a bit
Thanks!
sorry it took a while, got busy, but i have it working now
https://github.com/AgustinFrich/slim-php-deployment/pull/1
https://test-service2.up.railway.app/
Thank you so muchhh!!!!!!
all good?
All good, yes
awsome