ServerAlias www.example.com is not recognized
- by Tianzhou Chen
Below is my config file:
NameVirtualHost 12.34.56.78:80
< VirtualHost 12.34.56.78:80
ServerAdmin admin@domain1.com
ServerName domain1.com
ServerAlias www.domain1.com
DocumentRoot /srv/www/domain1.com/public_html1/
ErrorLog /srv/www/domain1.com/logs/error.log
CustomLog /srv/www/domain1.com/logs/access.log combined
< /VirtualHost
< VirtualHost 12.34.56.78:80
ServerAdmin admin@domain2.com
ServerName domain2.com
ServerAlias www.domain2.com
DocumentRoot /srv/www/domain2.com/public_html1/
ErrorLog /srv/www/domain2.com/logs/error.log
CustomLog /srv/www/domain2.com/logs/access.log combined
< /VirtualHost
The thing is when I put www.domain1.com into browser, apache2 doesn't retrieve the web page resides in /srv/www/domain1.com/public_html1/, instead, it gets the page from the default document root defined in another file. However, if I put www.domain2.com, everything works fine. I don't see any difference between two VirtualHost config block, so I wonder what does make the difference. BTW, I haven't put any .htaccess file under their document root.
Thanks for your advice!
Tianzhou