I just set up a micro instance of an Ubuntu web server an Amazon EC2. Everthing is running great, I've managed to configure the VirtualHost but I'm having a hard time setting up a subdomain. Here's what I've done:
$ mkdir /var/www/mydomain
$ mkdir /var/www/mysubdomain
$ chmod -R 774 /var/www/mydomain
$ chmod -R 774 /var/www/mysubdomain
$ vim /etc/apache2/sites-available/mydomian
<VirtualHost *:80>
ServerAdmin me@me.com
ServerName mydomain.com
ServerAlias www.mydomain.com
DocumentRoot /var/www/mydomian
</VirtualHost>
$ vim /etc/apache2/site-available/mysubdomain
<VirtualHost *:80>
ServerName mysubdomain.localhost # also tried mysubdomain.mydomain.com
DocumentRoot /var/www/mysubdomian
<Directory /var/www/mysubdomain/ >
Options Indexes FollowSymLinks MultiViews +Includes
AllowOverride All
Order allow,deny
allow from all
</Directory>
</VirtualHost>
$ ln -s /etc/apache2/sites-available/mydomian /etc/apache2/sites-enabled/mydomian
$ ln -s /etc/apache2/sites-available/mysubdomain /etc/apache2/sites-enabled/mysubdomain
After restarting Apache mydomain.com works fine but mysubdomain.mydomain.com doesn't work. Any ideas?
PS I've also added staging.localhost to /etc/hosts (not sure if I need to do that but...)