I've searched for two days, but I couldn't find an explanation for this behavior.
I have followed AWS docs. I've launched ec2 instance with recommend Amazon Linux AMI (aki-c48f51d9). Then customized my ec2 instance to my needs, including Apache's config: /etc/httpd/conf/httpd.conf My customization created two Virtual Hosts, as indicated below:
<VirtualHost *:80>
ServerName www.domain1.com
ServerAlias domain1.com
ServerAdmin [email protected]
DocumentRoot "/var/www/html/folder1"
</VirtualHost>
<VirtualHost *:80>
ServerName subdomain.domain1.com
ServerAdmin [email protected]
DocumentRoot "/var/www/html/folder2"
</VirtualHost>
This was tested and worked as expected, routing requests for subdomain.domain1.com to /var/www/html/folder2.
So I proceeded creating a custom AMI from this ec2 instance. After successful AMI creation, I used this AMI to launch a new ec2 instance. Now, for my surprise, on this new ec2 instance, the configuration of my second virtual host was slightly changed to:
<VirtualHost *:80>
ServerName subdomain.domain1.com
ServerAdmin [email protected]
DocumentRoot "/var/www/html/folder1"
</VirtualHost>
Notice that DocumentRoot somehow changed from original "folder2" to "folder1", same as default virtual host (first one). What happened? I would appreciate any help that could point me on resolution for this issue. thanks in advance!