Create an Elasticbeanstalk environment (php) with a documentRoot /web. Got DocumentRoot '/var/www/html/web' is not a directory, or is not readable

0

Hello

I tried to create a new Environment (php) manually through UI. The environment is just have as "Sample application" with Apache server. I then entered "DocumentRoot" as /web (instead of empty). However, the environment was not created successfully:

I ssh to that server and ran the command:

systemctl status httpd.service

Mar 07 22:30:28 ip-10-1xxxxxxxxxxx.compute.internal httpd[2539]: DocumentRoot '/var/www/html/web' is not a directory, or is not readable

I checked and found that the folder /var/www/html/web is not created automatically.

Could you please help - to fix this error

Thanks

son
asked 2 months ago196 views
1 Answer
0
Accepted Answer

Hello.

The content of Elasticbeanstalk's php sample application is placed in "/var/www/html", so setting the document root to "/web" will result in an error.
Even if you set the "DocumentRoot" value, ElasticBeanstalk should not automatically create the directory, so that error will occur.
For example, if your custom application has content in a directory called "/web", the value of "DocumentRoot" should be "/web".

ls -la /var/www/html/
total 20
drwxr-xr-x. 2 webapp webapp  107 Mar  8 00:49 .
drwxr-xr-x. 3 root   root     21 Mar  8 00:49 ..
-rw-r--r--. 1 webapp webapp   90 Sep 29 19:02 cron.yaml
-rw-r--r--. 1 webapp webapp 2769 Sep 29 19:02 index.php
-rw-r--r--. 1 webapp webapp  189 Sep 29 19:02 logo_aws_reduced.gif
-rw-r--r--. 1 webapp webapp  367 Sep 29 19:02 scheduled.php
-rw-r--r--. 1 webapp webapp 3490 Sep 29 19:02 styles.css

https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create_deploy_PHP.container.html#php-console

Document root – The folder that contains your site's default page. If your welcome page is not at the root of your source bundle, specify the folder that contains it relative to the root path. For example, /public if the welcome page is in a folder named public.

profile picture
EXPERT
answered 2 months ago
profile picture
EXPERT
reviewed a month ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions