Home > Back-end >  Laravel on AWS with SSL - 404 Not Found errors
Laravel on AWS with SSL - 404 Not Found errors

Time:05-25

I have a laravel project I am trying to run on AWS Elasticbeanstalk - I uploaded the project and worked 100% using HTTP, the client decided they wanted SSL , when I upload the exact same source code, my landing page works perfectly (https://sitename/), however any other page such as https://sitename/login will not work at all and I receive a 404 Not Found errors message.

The output I have is as follows (I zero'ed out the ip address except the last section to give it context):

2022/05/25 03:51:46 [error] 7872#7872: *21072 open() "/var/www/html/public/login" failed (2: No such file or directory), client: 000.00.00.164, server: , request: "GET /login HTTP/1.1", host: "00.000.000.113"
2022/05/25 03:57:03 [error] 7871#7871: *21210 open() "/var/www/html/public/_debugbar/assets/javascript" failed (2: No such file or directory), client: 000.00.00.164, server: , request: "GET /_debugbar/assets/javascript?v=1644364352 HTTP/1.1", host: "portal.sitename", referrer: "https://portal.sitename/"
2022/05/25 03:57:03 [error] 7872#7872: *21209 open() "/var/www/html/public/_debugbar/assets/stylesheets" failed (2: No such file or directory), client: 000.00.00.164, server: , request: "GET /_debugbar/assets/stylesheets?v=1644364352&theme=auto HTTP/1.1", host: "portal.sitename", referrer: "https://portal.sitename/"
2022/05/25 04:01:26 [error] 7872#7872: *21313 open() "/var/www/html/public/ReportServer" failed (2: No such file or directory), client: 000.00.00.193, server: , request: "GET /ReportServer HTTP/1.1", host: "13.244.47.136"
2022/05/25 04:01:39 [error] 7872#7872: *21320 open() "/var/www/html/public/ReportServer" failed (2: No such file or directory), client: 000.00.00.164, server: , request: "GET /ReportServer HTTP/1.1", host: "00.000.000.113"
2022/05/25 04:08:15 [error] 7872#7872: *21477 open() "/var/www/html/public/login" failed (2: No such file or directory), client: 000.00.00.193, server: , request: "POST /login HTTP/1.1", host: "portal.sitename", referrer: "https://portal.sitename/"

CodePudding user response:

There's documentation available for laravel in combination with beanstalk.

Your issue is caused by the webserver searching for files in the wrong directory. Did you choose PHP as platform? And do you have set the Document Root to /public?

CodePudding user response:

This is happening because your server is not accepting query string in url. For solving this you should add another folder called .platform and follow the text inside laravel.conf file like below. This will be fixed Be sure you are using nginx as server from elastic benstalk configuration

.platform configuration

laravel.conf file

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