0

The ServerName works fine by going via url in a browser and the ServerAlias is going to the default web site. Nothing remarkable in error logs for the site.

<VirtualHost *:80>
     ServerName domain.com
     ServerAlias www.domain.com
     DocumentRoot /data/sites/domain.com/www/docs

     ErrorLog /data/sites/domain.com/www/logs/error.log
     CustomLog /data/sites/domain.com/www/logs/access.log combined
</VirtualHost>

thx

Here's the default virtual host:

<VirtualHost *:80>
      ServerAdmin webmaster@localhost

    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>

    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
    <Directory "/usr/lib/cgi-bin">
            AllowOverride None
            Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
            Order allow,deny
            Allow from all
    </Directory>

    ErrorLog /var/log/apache2/error.log

    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel warn

    CustomLog /var/log/apache2/access.log combined

    Alias /doc/ "/usr/share/doc/"
    <Directory "/usr/share/doc/">
        Options Indexes MultiViews FollowSymLinks  
         AllowOverride None
         Order deny,allow
         Deny from all
         Allow from 127.0.0.0/255.0.0.0 ::1/128
      </Directory>
    </VirtualHost>
5
  • So it's being served by a different VirtualHost block when you request www.domain.com? What's its config look like? Sep 27, 2011 at 0:48
  • vhost looks fine to me, which means your problem is somewhere else. What is your NameVirtualHost directive? Have you checked to make sure that www.domain.com doesn't appear in any other sections?
    – DerfK
    Sep 27, 2011 at 0:49
  • @shane - the whole config? it's a plain vanilla ubuntu apache2.conf and other ones are working ok. Looking at it more, I think it might be a networking issue. Obviously, domain.com is not the real domain. Just change it because I don't want to put compromising info out there. Definitely not a unix admin.
    – timpone
    Sep 27, 2011 at 0:57
  • let me look into this more as another domain is doing the same thing :-( Fortunately, not in production yet.
    – timpone
    Sep 27, 2011 at 0:58
  • As @DerfK mentioned, I was curious whether www.domain.com is configured as the ServerName for the default vhost. Sep 27, 2011 at 0:59

2 Answers 2

1

No ServerName is present in your default VirtualHost. This means that Apache will try to figure out the hostname using DNS. If it's guessing that the correct name is www.domain.com, it'll take requests to that address instead of giving them to the vhost with the ServerAlias for that name.

Set a junk ServerName in that VirtualHost, and see if that helps.

Or just a2dissite default.

0

You need a CNAME record for the www subdomain in your DNS setup ... have you checked that?

1
  • I think this is a DNS issue. a cname for www-> root was added
    – timpone
    Sep 27, 2011 at 1:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .