How to redirect traffic to https for a Laravel AWS ElasticBeanstalk deployment on Nginx
Last updated: Dec 21st 2024
Laravel | AWS ElasticBeanstalk | Nginx | SSL
If you are working with Laravel or any PHP application and would like to deploy it to AWS EC2 instance through an ElasticBeanstalk, you could do that for sure. Assuming that you are deploying it on the Nginx webserver, there are a few things that you need to consider.
You would have to tell the webserver to read the .php files
You need to add the SSL certificates onto the server. This can be done through the .ebextension configration
You need to create a redirect on the NGinx server for all http requests to https
AWS allows you to overwrite the NGINX conf file which can be done simply by placing a file in the following path.
.platform\nginx\nginx.conf
Put the following code which listens to both ports 80 and 443. Also the config tells the server to use the location path for php files.
Comments