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

后端 未结 6 921
日久生厌
日久生厌 2020-12-08 22:57

I\'ve just deploy a new laravel 7 application on AWS Elastic beanstalk. I\'ve noticed they changed the Apache server to Nginx server.

https://docs.aws

6条回答
  •  无人及你
    2020-12-08 23:31

    If you are using Amazon linux 2 with elastic beanstalk with an nginx server then you need to follow the guidance here https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/platforms-linux-extend.html

    Simply though all you need to do is create a folder structure mapping the nginx config location you want to place you config file with .platform as the topmost folder this should be in your application root

    i.e. in a laravel app create a folder called .platform in the same level as the app folder within this .platform folder create the following /nginx/conf.d/elasticbeanstalk so you have a folder structure like .platform/nginx/conf.d/elasticbeanstalk in this last folder elasticbeanstalk place your config file

    e.g. laravel.conf

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

    once you upload the application to eb it will copy the file to the same location on the server and restart nginx Hope that makes sense

提交回复
热议问题