0

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/"
2
  • Are you using nginx or apace in Elastic Benstalk? Commented May 25, 2022 at 12:20
  • How did you setup SSL Cert? Commented May 26, 2022 at 4:01

3 Answers 3

1

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;
}
Sign up to request clarification or add additional context in comments.

3 Comments

I assume you mean create .platform and the directory structure from the /var/www/html
you should create your .ebextensions directory along with public, config, database, storage directory . and just push to elastic benstalk using aws codepipeline and deploy. Then rest will be done by aws elastic benstalk
I recently deployed two laravel app using elb, ec2, pipeline, codedeploy,pipeline, codebuild, s3 easily in amazon cloud .
0

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?

2 Comments

I certainly did change it to /public, other wise it wouldnt see my landing page at all
I used that exact documentation as per my original post, it worked 100% using HTTP, as soon as a cert was installed and I point to https , the problems started
0

Thanks to all for assisting , for anyone following this is what I did to resolve:

cd  /etc/nginx/conf.d/elasticbeanstalk
nano laravel.conf

added the following code:

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.