Rushabh Joshi
Rushabh Joshi

Reputation: 233

Custom nginx configuration for Laravel in AWS Elastic Beanstalk

Hi I am using AWS elastic beanstalk for my Laravel application

When I first uploaded my application it is not showing the login page, 404 error so I tried with app_url/index.php/login and it worked

This is how I figure out I need to add this to my Nginx configuration, I manually added this, ssh into ec2 instance, and worked

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

but every time I deploy my new code it replaces my manual code

I also read https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/java-tomcat-proxy.html?icmpid=docs_elasticbeanstalk_console this doc and created this folder structure in my application root folder

.ebextensions
  nginx
    conf.d
      elasticbeanstalk
        my-server-conf.conf

Seems not working for me Please let me know what should I put In my-server-conf.conf file and what should I do so it works for every deploy

Upvotes: 1

Views: 509

Answers (1)

Marcin
Marcin

Reputation: 238189

You should be using .platform, not .ebextensions as explained in aws docs. For example:

.platform/nginx/conf.d/elasticbeanstalk/laravel.conf

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

Upvotes: 3

Related Questions