When launching EC2 on Elastic Beanstalk, Apache's Document Root
It has become. I tried to change this, but I did something a little tricky, so I'll leave it.
64bit Amazon Linux/2.9.3 Apache/2.4.41
Put the following files in the .ebextensions folder.
files: /etc/httpd/conf/myhttpd.conf: content: | ##The contents of the conf file with the Docment Root changed are described below. ##For example ↓↓ DocumentRoot "/var/www/html/public" #### End of AWS Settings #### container_commands: 00-rm-httpd-conf: command: "sudo rm /etc/httpd/conf/httpd.conf" 01-cp-conf-file: command: "sudo cp /etc/httpd/conf/myhttpd.conf /etc/httpd/conf/httpd.conf" 02-httpd-restart: command: "sudo httpd -k restart"
In this file
(1) Place the configuration file
myhttpd.conf with the changed Document Root in EC2.
(2) After starting Apache with the original configuration file
④ Restart Apache
I am following the procedure.
Originally I tried to overwrite
httpd.conf before the first Apache launch, but for some reason Document Root was rewritten to the default.
So I took a little tricky procedure.