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
So I just had this issue and had to figure it out. The default php implementation doesn't factor in the folder difference that laravel causes (and this isn't mentioned anywhere in the docs)
You need to track down your nginx site config on your ec2 server. For me it was:
/etc/nginx/conf.d/elasticbeanstalk/php.conf
sudo nano php.conf
root default is /var/www/html; This is incorrect, the laravel folder is added here, you need to add this in:
root /var/www/html/your-laravel-app-name/public;
You will need to be in your ec2 server for this, so you can always navigate to that folder and check it.
I'm sure other people will be able to provide what's need to auto-configure this in the elastic beanstalk environment.
I also added the following lines to the nginx config for a base laravel config:
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ /\.ht {
deny all;
}
location ~ /.well-known {
allow all;
}