apache2 - DocumentRoot is set to docRoot of a virtualHost? -
os: centos 6.3 final
i've installed mysql , apache2(httpd) packages , changed config in /etc/httpd/conf/httpd.conf seen below:
<virtualhost *:80> documentroot /var/www/html/wordpress/ servername www.asterix.int </virtualhost> <virtualhost *:80> documentroot /var/www/html/staticsite/ servername www.meins.lan serveralias www.deins.lan serveralias www.obelix.int </virtualhost> <virtualhost *:80> documentroot /var/www/html/joomla/ servername www.example.com serveralias www2.example.com serveralias www3.example.com </virtualhost>
all servername , serveralias working fine , can access 3 pages.
but when i'm trying access page on server's ip strange (at least me) happens. apache2 returns me index page of first defined virtualhost(in example wordpress). i've tried 3 virtualhosts , same results.
is normal behavior or i'm doing false ?
if normal behavior: can set documentroot exclusively requests ip ?
thx !
this intended behavior. if use ip (let's http://123.123.123.123/
), apache use 123.123.123.123
http hostname. since there no virtualhost servername
or serveralias
of 123.123.123.123
, first virtualhost used.
so if want virtualhost listens http://123.123.123.123/
can create virtualhost with:
<virtualhost *:80> documentroot /var/www/html/my-ip-site/ servername 123.123.123.123 </virtualhost>
Comments
Post a Comment