I'm running an AWS setup that currently consists of an ELB pointing to a single EC2 instance. The instance is running Ubuntu 12.04.2 and Apache 2.22.2. I've setup several subdomains on the server in the past. I'm trying to set another one up today, but I'm beating my head against the wall trying to figure out what I missed. I'm sure it's some little step that I've overlooked or gotten not-quite-right.
My DNS records are setup using Route 53. I logged in to the AWS console and added a new CNAME record for my server. We'll call it samael.example.com. It looks like this:
samael.example.com. 3600 IN CNAME web-pool-xxxxxxxxxx.us-east-1.elb.amazonaws.com. That seems to be working just fine, as pointing my browser to sameael.example.com brings up the default VirtualHost.
So, all I have left to do now is create another VirtualHost config file, right?
mkdir /http/www/samael.example.com touch /httpd/www/samael.example.com/index.html cd /etc/apache2/sites-available sudo cp dav.example.com samael.example.com sudo sed -i 's/dav.example.com/samael.example.com/g' samael.example.com cd ../sites-enabled sudo ln -s ../sites-available/samael.example.com sudo apachectl restart That should be it, right? But when I point my browser to samael.example.com, it's still pointing to the default VirtualHost. What step am I skipping?
cat samael.example.com
<VirtualHost *:80> ServerName samael.example.com ServerAdmin webmaster@localhost DocumentRoot /httpd/www/samael.example.com <Directory /> Options FollowSymLinks AllowOverride None </Directory> <Directory /httpd/www/samael.example.com> Options FollowSymLinks AllowOverride All Order allow,deny allow from all </Directory> ErrorLog /var/log/apache2/samael.example.com-error.log # Possible values include: debug, info, notice, warn, error, crit, # alert, emerg. LogLevel warn CustomLog /var/log/apache2/samael.example.com-access.log combined EDIT:
Per the request in the comments:
sudo apache2ctl -S VirtualHost configuration: wildcard NameVirtualHosts and _default_ servers: *:80 is a NameVirtualHost default server dav.example.com (/etc/apache2/sites-enabled/dav.example.com:1) port 80 namevhost dav.example.com (/etc/apache2/sites-enabled/dav.example.com:1) port 80 namevhost dev.example.com (/etc/apache2/sites-enabled/dev.example.com:1) port 80 namevhost example.com (/etc/apache2/sites-enabled/example.com:1) port 80 namevhost new.example.com (/etc/apache2/sites-enabled/new.example.com:1) port 80 namevhost samael.example.com (/etc/apache2/sites-enabled/samael.example.com:1) port 80 namevhost stage.example.com (/etc/apache2/sites-enabled/stage.example.com:1) port 80 namevhost test.example.com (/etc/apache2/sites-enabled/test.example.com:1) Syntax OK The output of this is a bit puzzling to me. I would expect the default to be example.com rather than dav.example.com. The configuration file for example.com has ServerAlias * defined in it.
apache2ctl -S, also for ubuntu there are the helpersa2ensitea2dissitetools for managing enabled and available links. manpages.ubuntu.com/manpages/hardy/man8/a2ensite.8.html and manpages.ubuntu.com/manpages/hardy/man8/a2enmod.8.html can somewhat simplify working with Apache2 on Ubuntu.