502 error when viewing the link to my laravel project. What could the issue be?

psammystprimeTRIAL

6 months ago

When i run my project locally using phap artisan, it builds successfully and app loads on local host. On production, the app also builds successfully but the link provided gives a 502 error and not the homepage ofmy app that i expected.

I'm not using neither apache nor or Nginx web server.

I use 'composer install' as the build command and 'php artisan serve' as the start command.

The port url in the env is 8000.

Any help is appreciated.

Solved

7 Replies

6 months ago

Hello,

php artisan serve is not meant for production use. It's a lightweight development server.

For production, you should use proper web servers like Caddy or NGINX and you should configure them with PHP-FPM.


psammystprimeTRIAL

6 months ago

Thanks for your response. Honestly, i'm new to php and this is a project i've been handed to by a client. Could you give a short step by step description as to how i can achieve this using NGINX? I'm on a windows laptop.


6 months ago

I'm really sorry but we can't offer project help here, this forum is for platform help and support.

But I noticed you already are using a Dockerfile, so converting your project to use Caddy or NGINX would be simple, and most importantly it doesn't related directly to the Railway platform, so you can use resources you find online!


psammystprimeTRIAL

6 months ago

Thank you, i'll scoar for some resources. One question though, since i intend to use NGINX, which start command will i use to run the app?


6 months ago

I'm sure the guides and docs you read will cover that, I wouldn't know it off the top of my head.


psammystprimeTRIAL

6 months ago

Thank you. Best employee ever . I didn't expect to get this quick response since i'm on a free trial.


6 months ago

Thank you for your kind words, and I'm sorry we couldn't offer project support.


Status changed to Solved brody 6 months ago


502 error when viewing the link to my laravel project. What could the issue be? - Railway Help Station