ServerAlias www.example.com is not recognized

Posted by Tianzhou Chen on Stack Overflow See other posts from Stack Overflow or by Tianzhou Chen
Published on 2010-06-11T15:49:59Z Indexed on 2010/06/12 2:53 UTC
Read the original article Hit count: 453

Filed under:
|

Below is my config file:

NameVirtualHost 12.34.56.78:80

< VirtualHost 12.34.56.78:80 >
ServerAdmin [email protected]
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 [email protected]
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

© Stack Overflow or respective owner

Related posts about apache2

Related posts about virtualhost