Zmuffin
Zmuffin

Reputation: 53

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:

Edit: Solution for the problem is in this link

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

Upvotes: 4

Views: 1579

Answers (2)

Aliakbar sultani
Aliakbar sultani

Reputation: 38

Create a file named: laravel.conf in this directory: .platform/nginx/conf.d/elasticbeanstalk

Copy paste this content inside laravel.conf file:

location / {
    try_files $uri $uri/ /index.php?$query_string;
    gzip_static on;
}

Upvotes: 0

Miguel Mascarenhas
Miguel Mascarenhas

Reputation: 11

  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;
}

Upvotes: 1

Related Questions