skip to Main Content

I am a bit new to AWS Elastic Beanstalk
I used AWS Elastic Beanstalk to create a PHP 7 deployment for a Laravel project which runs perfectly on my laptop. then uploaded my Laravel project files, edited the .env file
Now I’m getting a 404 Not Found error
404 webpage
On the elastic beanstalk console, the health of the server is ok but I am still getting the 404 not found error. Please help me fix this
public path already set
Can I create an IAM user or pen file that will allow me to access the ec2 via ssh?
the health of server is ok
How do I fix the 404 NOT FOUND error because I cannot see and access the files in ec2 created by Elastic beanstalk
unable to launch terminal in ec2 console
see logs from the server below

----------------------------------------
/var/log/nginx/error.log
----------------------------------------
2021/05/02 10:37:13 [error] 3601#0: *1 "/var/www/html/public/index.php" is not found (2: No such file or directory), client: 203.159.80.30, server: , request: "GET / HTTP/1.1", host: "18.222.4.168:80"
2021/05/02 10:37:13 [error] 3601#0: *1 testing "/var/www/html/public" existence failed (2: No such file or directory) while logging request, client: 203.159.80.30, server: , request: "GET / HTTP/1.1", host: "18.222.4.168:80"
2021/05/02 10:43:42 [error] 3601#0: *2 "/var/www/html/public/index.php" is not found (2: No such file or directory), client: 129.205.124.143, server: , request: "GET / HTTP/1.1", host: "trikleqtspendapi-env.eba-ghdkmh8i.us-east-2.elasticbeanstalk.com"
2021/05/02 10:43:42 [error] 3601#0: *2 testing "/var/www/html/public" existence failed (2: No such file or directory) while logging request, client: 129.205.124.143, server: , request: "GET / HTTP/1.1", host: "trikleqtspendapi-env.eba-ghdkmh8i.us-east-2.elasticbeanstalk.com"


----------------------------------------
/var/log/eb-engine.log
----------------------------------------
2021/05/02 10:31:29.364543 [INFO] Running command /bin/sh -c systemctl start aws-eb.target
2021/05/02 10:31:29.368812 [INFO] Running command /bin/sh -c systemctl enable healthd.service
2021/05/02 10:31:29.449379 [INFO] Running command /bin/sh -c systemctl show -p PartOf healthd.service
2021/05/02 10:31:29.454445 [INFO] Running command /bin/sh -c systemctl is-active healthd.service
2021/05/02 10:31:29.457846 [INFO] Running command /bin/sh -c systemctl start healthd.service
2021/05/02 10:31:29.482778 [INFO] Copying file /opt/elasticbeanstalk/config/private/healthd/healthd_logformat.conf to /var/proxy/staging/nginx/conf.d/healthd_logformat.conf
2021/05/02 10:31:29.484360 [INFO] Copying file /opt/elasticbeanstalk/config/private/healthd/healthd_nginx.conf to /var/proxy/staging/nginx/conf.d/elasticbeanstalk/healthd.conf
2021/05/02 10:31:29.486171 [INFO] Executing instruction: configure php-fpm
2021/05/02 10:31:29.491762 [INFO] Executing instruction: configure log streaming
2021/05/02 10:31:29.491773 [INFO] log streaming is not enabled
2021/05/02 10:31:29.491776 [INFO] disable log stream
2021/05/02 10:31:29.491789 [INFO] Running command /bin/sh -c systemctl show -p PartOf amazon-cloudwatch-agent.service
2021/05/02 10:31:29.501425 [INFO] Running command /bin/sh -c systemctl stop amazon-cloudwatch-agent.service
2021/05/02 10:31:29.507101 [INFO] Executing instruction: GetToggleForceRotate
2021/05/02 10:31:29.507113 [INFO] Checking if logs need forced rotation
2021/05/02 10:31:29.507131 [INFO] Running command /bin/sh -c /opt/aws/bin/cfn-get-metadata -s arn:aws:cloudformation:us-east-2:630589988206:stack/awseb-e-pw9i7apndy-stack/5104d330-ab31-11eb-815f-0a30b5a1ab58 -r AWSEBAutoScalingGroup --region us-east-2
2021/05/02 10:31:30.087814 [INFO] Running command /bin/sh -c /opt/aws/bin/cfn-get-metadata -s arn:aws:cloudformation:us-east-2:630589988206:stack/awseb-e-pw9i7apndy-stack/5104d330-ab31-11eb-815f-0a30b5a1ab58 -r AWSEBBeanstalkMetadata --region us-east-2
2021/05/02 10:31:30.620774 [INFO] Procfile not found. Generating default rsyslog config
2021/05/02 10:31:30.621989 [INFO] Running command /bin/sh -c systemctl restart rsyslog.service
2021/05/02 10:31:30.639310 [INFO] Executing instruction: PostBuildEbExtension
2021/05/02 10:31:30.639330 [INFO] Starting executing the config set Infra-EmbeddedPostBuild.
2021/05/02 10:31:30.639343 [INFO] Running command /bin/sh -c /opt/aws/bin/cfn-init -s arn:aws:cloudformation:us-east-2:630589988206:stack/awseb-e-pw9i7apndy-stack/5104d330-ab31-11eb-815f-0a30b5a1ab58 -r AWSEBAutoScalingGroup --region us-east-2 --configsets Infra-EmbeddedPostBuild
2021/05/02 10:31:30.957729 [INFO] Finished executing the config set Infra-EmbeddedPostBuild.

2021/05/02 10:31:30.957750 [INFO] Executing instruction: CleanEbExtensions
2021/05/02 10:31:30.957774 [INFO] Cleaned ebextensions subdirectories from app staging directory.
2021/05/02 10:31:30.957778 [INFO] Executing instruction: RunAppDeployPreDeployHooks
2021/05/02 10:31:30.957798 [INFO] The dir .platform/hooks/predeploy/ does not exist in the application. Skipping this step...
2021/05/02 10:31:30.957803 [INFO] Executing instruction: stop X-Ray
2021/05/02 10:31:30.957807 [INFO] stop X-Ray ...
2021/05/02 10:31:30.957821 [INFO] Running command /bin/sh -c systemctl show -p PartOf xray.service
2021/05/02 10:31:30.965110 [WARN] stopProcess Warning: process xray is not registered 
2021/05/02 10:31:30.965139 [INFO] Running command /bin/sh -c systemctl stop xray.service
2021/05/02 10:31:30.972353 [INFO] Executing instruction: stop proxy
2021/05/02 10:31:30.972370 [INFO] Running command /bin/sh -c systemctl show -p PartOf httpd.service
2021/05/02 10:31:30.980459 [WARN] deregisterProcess Warning: process httpd is not registered, skipping...

2021/05/02 10:31:30.980487 [INFO] Running command /bin/sh -c systemctl show -p PartOf nginx.service
2021/05/02 10:31:30.986489 [WARN] deregisterProcess Warning: process nginx is not registered, skipping...

2021/05/02 10:31:30.986501 [INFO] Executing instruction: stop php-fpm
2021/05/02 10:31:30.986522 [INFO] Running command /bin/sh -c systemctl show -p PartOf php-fpm.service
2021/05/02 10:31:30.991331 [WARN] stopProcess Warning: process php-fpm is not registered 
2021/05/02 10:31:30.991360 [INFO] Running command /bin/sh -c systemctl stop php-fpm.service
2021/05/02 10:31:30.995942 [INFO] Executing instruction: FlipApplication
2021/05/02 10:31:30.996531 [INFO] create soft link from /var/app/current/ to /var/www/html
2021/05/02 10:31:30.996560 [INFO] Executing instruction: start X-Ray
2021/05/02 10:31:30.996567 [INFO] X-Ray is not enabled.
2021/05/02 10:31:30.996572 [INFO] Executing instruction: start php-fpm
2021/05/02 10:31:30.996641 [INFO] Running command /bin/sh -c systemctl show -p PartOf php-fpm.service
2021/05/02 10:31:31.002929 [INFO] Running command /bin/sh -c systemctl daemon-reload
2021/05/02 10:31:31.073037 [INFO] Running command /bin/sh -c systemctl reset-failed
2021/05/02 10:31:31.076919 [INFO] Running command /bin/sh -c systemctl show -p PartOf php-fpm.service
2021/05/02 10:31:31.081715 [INFO] Running command /bin/sh -c systemctl is-active php-fpm.service
2021/05/02 10:31:31.085118 [INFO] Running command /bin/sh -c systemctl start php-fpm.service
2021/05/02 10:31:31.349359 [INFO] Executing instruction: start proxy with new configuration
2021/05/02 10:31:31.349393 [INFO] Running command /bin/sh -c /usr/sbin/nginx -t -c /var/proxy/staging/nginx/nginx.conf
2021/05/02 10:31:31.370795 [INFO] Running command /bin/sh -c cp -rp /var/proxy/staging/nginx/* /etc/nginx
2021/05/02 10:31:31.374022 [INFO] Running command /bin/sh -c systemctl show -p PartOf nginx.service
2021/05/02 10:31:31.380855 [INFO] Running command /bin/sh -c systemctl daemon-reload
2021/05/02 10:31:31.457630 [INFO] Running command /bin/sh -c systemctl reset-failed
2021/05/02 10:31:31.461627 [INFO] Running command /bin/sh -c systemctl show -p PartOf nginx.service
2021/05/02 10:31:31.466574 [INFO] Running command /bin/sh -c systemctl is-active nginx.service
2021/05/02 10:31:31.469974 [INFO] Running command /bin/sh -c systemctl start nginx.service
2021/05/02 10:31:31.505744 [INFO] Executing instruction: configureSqsd
2021/05/02 10:31:31.505760 [INFO] This is a web server environment instance, skip configure sqsd daemon ...
2021/05/02 10:31:31.505765 [INFO] Executing instruction: startSqsd
2021/05/02 10:31:31.505769 [INFO] This is a web server environment instance, skip start sqsd daemon ...
2021/05/02 10:31:31.505777 [INFO] Executing instruction: Track pids in healthd
2021/05/02 10:31:31.505782 [INFO] This is an enhanced health env...
2021/05/02 10:31:31.505794 [INFO] Running command /bin/sh -c systemctl show -p ConsistsOf aws-eb.target | cut -d= -f2
2021/05/02 10:31:31.512459 [INFO] php-fpm.service nginx.service healthd.service cfn-hup.service

2021/05/02 10:31:31.512478 [INFO] Running command /bin/sh -c systemctl show -p ConsistsOf eb-app.target | cut -d= -f2
2021/05/02 10:31:31.517149 [INFO] 

2021/05/02 10:31:31.517270 [INFO] Executing instruction: RunAppDeployPostDeployHooks
2021/05/02 10:31:31.517283 [INFO] The dir .platform/hooks/postdeploy/ does not exist in the application. Skipping this step...
2021/05/02 10:31:31.517287 [INFO] Executing cleanup logic
2021/05/02 10:31:31.517408 [INFO] CommandService Response: {"status":"SUCCESS","api_version":"1.0","results":[{"status":"SUCCESS","msg":"Engine execution has succeeded.","returncode":0,"events":[{"msg":"Instance deployment: You didn't include a 'composer.json' file in your source bundle. The deployment didn't install Composer dependencies.","timestamp":1619951489,"severity":"INFO"},{"msg":"Instance deployment completed successfully.","timestamp":1619951491,"severity":"INFO"}]}]}

2021/05/02 10:31:31.517585 [INFO] Platform Engine finished execution on command: app-deploy

2021/05/02 10:47:20.878327 [INFO] Starting...
2021/05/02 10:47:20.878386 [INFO] Starting EBPlatform-PlatformEngine
2021/05/02 10:47:20.878402 [INFO] reading event message file
2021/05/02 10:47:20.878500 [INFO] no eb envtier info file found, skip loading env tier info.
2021/05/02 10:47:20.878563 [INFO] Engine received EB command cfn-hup-exec

2021/05/02 10:47:20.957130 [INFO] Running command /bin/sh -c /opt/aws/bin/cfn-get-metadata -s arn:aws:cloudformation:us-east-2:630589988206:stack/awseb-e-pw9i7apndy-stack/5104d330-ab31-11eb-815f-0a30b5a1ab58 -r AWSEBAutoScalingGroup --region us-east-2
2021/05/02 10:47:21.259415 [INFO] Running command /bin/sh -c /opt/aws/bin/cfn-get-metadata -s arn:aws:cloudformation:us-east-2:630589988206:stack/awseb-e-pw9i7apndy-stack/5104d330-ab31-11eb-815f-0a30b5a1ab58 -r AWSEBBeanstalkMetadata --region us-east-2
2021/05/02 10:47:21.609138 [INFO] checking whether command tail-log is applicable to this instance...
2021/05/02 10:47:21.609153 [INFO] this command is applicable to the instance, this instance should execute the command
2021/05/02 10:47:21.609157 [INFO] Engine command: (tail-log)

2021/05/02 10:47:21.609207 [INFO] Executing instruction: GetTailLogs
2021/05/02 10:47:21.609212 [INFO] Tail Logs...
2021/05/02 10:47:21.609472 [INFO] Running command /bin/sh -c tail -n 100 /var/log/nginx/access.log
2021/05/02 10:47:21.611205 [INFO] Running command /bin/sh -c tail -n 100 /var/log/nginx/error.log
2021/05/02 10:47:21.612684 [INFO] Running command /bin/sh -c tail -n 100 /var/log/eb-engine.log

2

Answers


  1. Chosen as BEST ANSWER

    I retested the uploaded folder on a different server and noticed there was an issue with the folder structure and fixed it and it's fine now Thanks for your imput


  2. Switching to a t2.* instance helped solve this issue for me. I think AWS needs to look into arm based instances, since they’re the ones with the issue.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search