I can't write a file with .ebextensions in /etc/httpd/conf.d/elasticbeanstalk. I need to write a vhost.conf to add subdomains. I am on I tried many ways : write the file with "files:..."
files:
"/etc/httpd/conf.d/elasticbeanstalk":
mode: "000777"
owner: root
group: root
encoding: plain
content: |
NameVirtualHost *:80
<VirtualHost *:80>
ServerName api.domain.com
DocumentRoot "/var/app/current/api/"
<Directory "/var/app/current/api">
AllowOverride All
Require all Granted
</Directory>
</VirtualHost>
Then i tried to write this file in temporary directory and copy it with a command to /etc/httpd/conf.d/elasticbeanstalk
files:
"/home/ec2-user/vhost.conf":
mode: "000777"
owner: root
group: root
encoding: plain
content: |
NameVirtualHost *:80
<VirtualHost *:80>
ServerName api.domain.com
DocumentRoot "/var/app/current/api/"
<Directory "/var/app/current/api">
AllowOverride All
Require all Granted
</Directory>
</VirtualHost>
container_commands:
00_chmod:
command: "sudo chmod 777 /etc/httpd/conf.d/elasticbeanstalk"
01_rewrite:
command: "sudo mv -f /home/ec2-user/vhost.conf /etc/httpd/conf.d/elasticbeanstalk/vhost.conf"
02_apache:
command: "sudo apachectl restart"
Not working too. So I checked some infos on ec2 instance with SSH. The file is create in /home/ec2-user but not in the apache folder. What am i doing wrong ? I can't create files in /etc/httpd/conf.d/elasticbeanstalk without chmod the directory (SSH).
I am on PHP 7.4 running on 64bit Amazon Linux 2/3.1.1 (proxy apache not nginx), I have the exact same directory .ebextension with same files on an other instance for an other application but on PHP 7.2 running on 64bit Amazon Linux/2.9.10, and it's working on this one ! what the difference betwwen those 2 env ?
EDIT : I have no error in logs, all commands are executed !
Thank you for any help !