If you are using Amazon Linux 2 with Elastic Beanstalk with an NGINX server then you need to follow this documentation.
Basically 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.
Extra
In some cases this might not be enough and when you try to go to any specific route you'll get a
419 | PAGE EXPIRED
To fix that simply SSH into your instance, go to the project location and clear the cache
php artisan cache:clear
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…