-1

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?

Trent Scott
  • 959
  • 1
  • 12
  • 28
  • 1
    Post the output of `/usr/sbin/apache2ctl -S` – Steven May 06 '11 at 00: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 09 '11 at 07:22

2 Answers2

1

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?

Halfgaar
  • 8,084
  • 6
  • 45
  • 86
  • 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 05 '11 at 22:44
  • You don't have apace2ctl? What does aptitude search "^apache2" say? Are you running it as root? – Halfgaar May 06 '11 at 13:39
0

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

Trent Scott
  • 959
  • 1
  • 12
  • 28