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-available
and 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:
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?
Answer
Not sure why you get this error when using ServerAlias
, however this should be the way to go.
From the docmuentation :
The
ServerAlias
directive sets the alternate names for a host, for
use with name-based virtual hosts
This is actually what you are doing, as you have defined www.hrsys.com.ng
as an alias (CNAME) in your DNS for hrsys.com.ng
.
No comments:
Post a Comment