Server Environment: Ubuntu 12.04 | Apache 2.2
I have disabled the default vhost configuration using
a2dissite default and deleted the default file from
sites-enabled. I have 3 domains pointed at the VPS at DigitalOcean and I've added CNAME records for
www linked to
domain.com. (with the trailing dot).
Theis is the current setup:
- domain1.com : http://pastie.org/9457734
- domain2.com : http://pastie.org/9457732
- domain3.com : No vhost defined, but pointed at VPS
Navigating to domain1.com serves the intended DocumentRoot, so does domain2.com. However, navigating to www.domain1.com serves the DocumentRoot of domain2.com (this is the problem). This doesn't seem to happen with www.domain2.com which serves the correct path. domain3.com which has no vhost created also mysteriously serves the content from domain2.com
If I delete the
www CNAME records, the links with www do not work after DNS propagation. I have seen suggestions to add a
ServerAlias directive in the vhost files. When I add such directives, Apache errors out with the following:
"ScriptAlias takes two arguments, a fakename and a realname"
How can I solve this problem?