I've got a server running Ubuntu 10.10 and LAMP that I'd like to configure a subdomain in Apache for. I have two websites that I want to serve:

mydomain.com (which resides in /var/www/mydomain)

AND

clients.mydomain.com (which resides in /var/www/clients)

I'm trying to use name-based virtual hosts and can't get the subdomain (clients.mydomain.com) working but mydomain.com resolves just fine.

Here's my configuration:

/etc/apache2/sites-enabled/mydomain.com.conf

<VirtualHost *:80>
DocumentRoot "/var/www/domain"
ServerName mydomain.com
<Directory "/var/www/mydomain">
allow from all
Options +Indexes
</Directory>
</VirtualHost>

/etc/apache2/sites-enabled/clients.mydomain.com.conf

<VirtualHost *:80>
DocumentRoot "/var/www/clients"
ServerName clients.mydomain.com
<Directory "/var/www/clients">
allow from all
Options +Indexes
</Directory>
</VirtualHost>

I also have an A record pointing clients.mydomain.com to the Ip of my server. Any idea on what's wrong?

link|improve this question

1  
Post the output of /usr/sbin/apache2ctl -S – Steven May 6 '11 at 0:56
You mentioned below it was a DNS issue. Tip: when you lower records, change the TTL beforehand. And, I prefer to keep them on 3600 sec (an hour) normally anyway. Another thing is, don't access the address until you've made the record, otherwise all servers in the chain will cache the non-record for days. And, you can run "dig A sub.domain.com @nameserver" to see if the record exists. And if you want to work without waiting for DNS, add "1.2.3.4 sub.domain.com" to your hosts file. – Halfgaar May 9 '11 at 7:22
Hmm good advice. Thanks. – Trent Scott May 11 '11 at 23:52
feedback

3 Answers

You point to sites-available. Are these sites symlinked in /etc/apache2/sites-enabled/? You can enable them with a2ensite.

If that's not it, do you have a NameVirtualHost *:80 in /etc/apache2/ports.conf? It's Ubuntu, so probably.

What does apachectl -t say?

link|improve this answer
They are symlinked in sites-enabled (sorry for the confusion). I have NameVirtualHost *:80 in ports.conf. apachectl -t and apache2ctl -t say command not found. Are they not compatible with bash? – Trent Scott May 5 '11 at 22:44
You don't have apace2ctl? What does aptitude search "^apache2" say? Are you running it as root? – Halfgaar May 6 '11 at 13:39
feedback

Missing a closing tag on the second one. Is this just a typo?

link|improve this answer
Just a typo (sorry about that). – Trent Scott May 5 '11 at 22:45
feedback
up vote 0 down vote accepted

Turned out to be a DNS propagation issue. That A record took nearly 48 hours to spread around.

link|improve this answer
48 hour propagation is normal! In fact count on it taking up to 72 hours. – Caleb May 7 '11 at 13:52
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.