I'm not quite clear on the difference between ServerName and ServerAlias. It looks like both of them work as host name settings, except that ServerAlias only works within the
That is, I can do:
ServerName www.domain1.com
ServerName www.domain2.com
or:
ServerName www.domain1.com
ServerName www.domain2.com
and both domains work on the same box. Can I use either ServerName or ServerAlias in this case?
Answer
The ServerName directive is
Hostname and port that the server uses to identify itself
Whilst ServerAlias is
Alternate names for a host used when matching requests to name-virtual hosts
Given a vhost configured like
...
ServerName example.com
ServerAlias www.example.com foo.example.com *.somewherelse.org
...
apache would respond to example.com
, www.example.com
foo.example.com
and anything in .somewherelse.org
with this VirtualHost
No comments:
Post a Comment