I am trying to configure an EC2 web server along with a domain named configured on Route 53 in AWS, but I am having trouble with getting subdomain working correctly. I can get to the server fine, just can't get the the subdomains.
The domain is hosted on GoDaddy, I've updated the name servers on GoDaddy to match the ones on AWS Route 53. When I try to go to example.com, it will arrive on my index page for the default virtualhost, but when I go to dev.example.com, it will also take me to the default virtualhost.
Here are some information regarding the setup:
EC2 Server IP: 10.10.10.1
Elastic IP: 1.1.1.1 (associated to network interface)
Domain Name: example.com
Route 53 DNS Configuration
example.com. NS (aws pre-configured)
example.com. SOA (aws pre-configured)
example.com. A 1.1.1.1
www.example.com. A 1.1.1.1
dev.example.com. A 1.1.1.1
/etc/hosts
127.0.0.1 dev.localhost localhost
/etc/apache2/sites-available/default (yes, they are symlink to sites-enabled)
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/main
ServerName localhost
...
</VirtualHost>
/etc/apache2/sites-available/dev (yes, they are symlink to sites-enabled)
<VirtualHost *:80>
ServerAdmin webmaster@dev.localhost
DocumentRoot /var/www/dev
ServerName dev.localhost
ServerAlias dev
...
</VirtualHost>