[TriLUG] Apache serving wrong website

bak bak at picklefactory.org
Tue Mar 11 11:17:53 EDT 2008


It wants

NameVirtualHost x.x.x.x:80

<VirtualHost sub.domain.org>
...
</VirtualHost>

<VirtualHost www.domain.org>
...
</VirtualHost>

See http://httpd.apache.org/docs/2.2/vhosts/name-based.html

--bak

Douglas Ward wrote:
> I have an apache server (CentOS 5 - httpd-2.2.3-11.el5_1.centos.3) that
> isn't returning web pages in the way that I think it should.  Here's my
> entry in vhosts.conf:
>
> <VirtualHost x.x.x.x>
>   ServerAdmin admin at domain.org
>   DocumentRoot /var/www/sub.domain.org
>   ServerName sub.domain.org
>    ServerAlias sub.domain.org
>   ErrorLog logs/sub.domain.org_error_log
>   CustomLog logs/sub.domain.org-access_log common
> </VirtualHost>
>
> <VirtualHost x.x.x.x>
>   ServerAdmin admin at domain.org
>   DocumentRoot /var/www/domain.org
>   ServerName domain.org
>    ServerAlias domain.org www.domain.org
>   ErrorLog logs/domain.org_error_log
>   CustomLog logs/domain.org-access_log common
> </VirtualHost>
>
>
> The server sends all traffic to the main domain website.  I need browsers
> that visit sub.domain.org to be sent to the correct site.  It was my
> understanding that as long as the sub domain was first in the configuration
> file it would work.  Am I missing something?  Shouldn't apache be able to do
> this?  I need to host both of these sites on the same server.  Any advice
> would be most appreciated.  Thank you!
>   




More information about the TriLUG mailing list