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 am trying to do something fairly simple. We have one dedicated server at ip [our server ip]

We have purchased several domain names.

I would like to host the sites under one ip.

I set up the zone file using the interface the company provides. Here is how it looks:

enter image description here

In apache2, running on Ubuntu 10.04, I go to /etc/apache2/sites-available/ and create a file named [domain name].com

The contents of this file are:

<VirtualHost *:80>
    ServerName [domain name].com
    DocumentRoot /var/www
    <Directory />
        Options FollowSymLinks
        AllowOverride None
    </Directory>
    <Directory /var/www/>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride None
        Order allow,deny
        allow from all
    </Directory>
</VirtualHost>

I run the command sudo a2ensite [domain name].com and restart the server. It doesn't work.

I changed the DNS records some 28 hours ago. What could be the issue?

What is working is the 'normal' site. I checked the DNS file and all the IN A types are pointing to the server ip.

What is different are the name servers; the working site has name servers from the site we bought the domains. The other one has name servers from a different place.

What could be wrong here?

Thanks, Dane

share|improve this question
    
Many possible things -- start with the basics: does opening http://ext.ern.al.ip in your browser get through the firewall to the web server (if not it is more-likely a firewall issue); is your internal DNS hosting the same zone as the external DNS (if so, did you update the internal DNS as well?); did you clear your DNS lookup cache from your client and your local DNS server; is the TTL for your domain longer than 28 hours? –  jimbobmcgee Aug 15 '12 at 15:39
    
Have you definitely turned on name based virtual hosting? You'll need to set the NameVirtualHost directive to: NameVirtualHost *:80 –  James Yale Aug 15 '12 at 16:30
    
@JamesYale yes, I have it set once in ports.conf –  Danedo Aug 15 '12 at 17:36
add comment

2 Answers 2

up vote 1 down vote accepted

First, if you are unsure that the DNS records have been updated try to ping www.yourdomain.com and see if the packets are being sent to the correct server IP address.

Then check that Apache is listening netstat -l -n | grep ":80" and that your firewall has port 80 open iptables -L -n | grep "dpt:80".

The contents of /var/www is normally used/reserved for the default site in apache2/sites-available/. When running virtual sites on a box I create a different directory for each /var/www/site1 /var/www/site2 etc... and set them as the DocumentRoot which is matched by the unique ServerName (domain name) in each config file under sites-available. This will prevent any confusion for Apache and also secure each site from other users (if providing FTP access per site).

share|improve this answer
add comment

your document root DocumentRoot /var/www should have seperate directories for each of the domains.
Heres an example of how I do my domain and sub domain

<VirtualHost *:80>
                ServerName www.mydomain.com
                ServerAlias mydomain.com
                ServerAdmin tech@mydomain.com
                DocumentRoot "/var/www/mydomain.com"
                <Directory /var/www/mydomain.com/admin>
                                AllowOverride All
                                Allow from all
                </Directory>
</VirtualHost>
<VirtualHost *:80>
                ServerName www.dev.mydomain.com
                ServerAlias dev.mydomain.com
                ServerAdmin tech@mydomain.com
                DocumentRoot "/var/www/dev.mydomain.com"
                <Directory /var/www/dev.mydomain.com>
                                AllowOverride All
                                Allow from all
                </Directory>
</VirtualHost>
share|improve this answer
add comment

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.