Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel Route not working after I deployed in Beanstalk AWS

I follow different article and tutorial video for deploying Laravel 5.6 in AWS Beanstalk. All the config are done; adding database (mysql) and upload zip file. Problem is, it shows 404 error in every route except "/" i.e root (aka website link). It shows first page or root page but does not show other route pages.

Error Screenshots

  1. Root Page (print env)
  2. Other route like (api)

Instruction and tutorial I followed:

  • https://www.youtube.com/watch?v=ISVaMijczKc
  • https://www.youtube.com/watch?v=Um1zQKPVFfU (EC2 Instance)
  • https://medium.com/sk-geek/deploy-laravel-app-to-elastic-beanstalk-amazon-ec2-6cdff6689347
  • https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/php-laravel-tutorial.html (official tutorial)
  • https://www.infinitypp.com/amazon-aws/how-to-hose-laravel-application-on-aws-elastic-beanstalk/ (EB CLI)
  • https://blog.memcachier.com/2019/01/28/laravel-elastic-beanstalk-and-memcache/

Edit: Solution for the problem is in this link

  • Any AWS EB Laravel route getting 404 Not Found nginx/1.16.1

  • Any AWS EB Laravel route getting 404 Not Found nginx/1.16.1

  • https://laravel.com/docs/8.x/deployment#nginx

Or change proxy server from "Nginx" to "Apache" in Environment Configuration

like image 834
Zmuffin Avatar asked Nov 06 '25 22:11

Zmuffin


1 Answers

  1. You need to create a folder structure like this in your root folder: .platform/nginx/conf.d/elasticbeanstalk/laravel.conf

  2. Paste this code in the "laravel.conf" file:

.

location / {
  try_files $uri $uri/ /index.php?$query_string;
}
like image 142
Miguel Mascarenhas Avatar answered Nov 09 '25 15:11

Miguel Mascarenhas



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!