Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|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

2 Answers 2

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?

share|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
up vote 0 down vote accepted

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

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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