Strange Name-Based Virtual Host problem with Apache 1.3.23 on Linux

Strange Name-Based Virtual Host problem with Apache 1.3.23 on Linux

Post by Tom Willia » Sat, 09 Mar 2002 03:21:34



Hi! Ok, I'm using Name-Based Virtual Hosts and I have 7 - 8 domains
registered that ALL point to the same IP address, we can use
192.168.0.1 as the example IP.  I have each virtual host logging
combined access info to different directories on my server and each
virtual host lives in its own directory:

# This LogFormat line *might* word wrap in this post... :)
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\"
\"%{User-Agent}i\"" combined
NameVirtualHost 192.168.0.1

<VirtualHost 192.168.0.1>
ServerName   www.domaina.com
DocumentRoot "/mnt/websites/www.domaina.com"
CustomLog "| /usr/local/cronolog/sbin/cronolog /usr/local/apache/logs\
/www.domaina.com/access_log.%Y.%m.%d" combined
</VirtualHost>

<VirtualHost 192.168.0.1>
ServerName   www.newdomain.com
DocumentRoot "/mnt/websites/www.newdomain.com"
CustomLog "| /usr/local/cronolog/sbin/cronolog /usr/local/apache/logs\
/www.newdomain.com/access_log.%Y.%m.%d" combined
</VirtualHost>

Now, I use the AWStats logfile analyzer to report stats and found
entries in the Referrer section that indicated data for host
"www.domaina.com" was being access from "www.newdomain.com" in the
access logfile for "www.domaina.com"!  Here is some output from the
access log for "www.domaina.com":

access_log.2002.03.06:aaa.bbb.ccc.ddd - - [06/Mar/2002:16:12:01 -0800]
"GET /images/gallery/pic17sm.jpg HTTP/1.1" 200 4555
"http://www.newdomain.com/member/pics03.htm" "Mozilla/4.0 (compatible;
MSIE 6.0; Windows NT 5.1; Q312461)"

The real kicker is the member directory does NOT exist in
/mnt/websites/www.newdomain.com at all, nor are they any symlinks to
any other directory or filesystem.

So, I took a quick look at the Referrer info that was logged:

"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; Q312461)"

and saw IE 6.0 was the browser use and HTTP 1.1 is the protocol being
used:

"GET /images/gallery/pic17sm.jpg HTTP/1.1" 200 4555

Yet, I do NOT know WHY the data from
"/mnt/websites/www.domaina.com/member" is being read when accessing
"www.newdomain.com", which is in a separate directory.

Any ideas?

Thanks in advance for your time.

Peace.....

Tom

 
 
 

Strange Name-Based Virtual Host problem with Apache 1.3.23 on Linux

Post by Tom Willia » Sat, 09 Mar 2002 06:58:29



> See docs for UseCanonicalName.  You are likely missing a slash at the end
> of a URL without a filename, and automatic redirection to correct your
> oversite is going to the effective ServerName or default vhost instead of
> to the host in the Host header.

Thanks for the tip!

Peace....

Tom

 
 
 

Strange Name-Based Virtual Host problem with Apache 1.3.23 on Linux

Post by Tom Willia » Sat, 09 Mar 2002 07:17:14



> See docs for UseCanonicalName.  You are likely missing a slash at the end
> of a URL without a filename, and automatic redirection to correct your
> oversite is going to the effective ServerName or default vhost instead of
> to the host in the Host header.

Ok, if I have this VirtualHost definition:

NameVirtalHost 192.168.0.1
<VirtualHost 192.168.0.1>
ServerName domain.com
DocumentRoot "/mnt/websites/domain.com"
ServerAlias www.domain.com
</VirtualHost>

and I access http://www.domain.com (no trailing slash), will the
ServerName and ServerAlias being different cause any confusion?  Does
it matter which name I use for the ServerName vs ServerAlias since
they BOTH resolve to the same IP?

Thanks again....

Peace....

Tom

 
 
 

Strange Name-Based Virtual Host problem with Apache 1.3.23 on Linux

Post by Tom Willia » Sat, 09 Mar 2002 07:21:30



> See docs for UseCanonicalName.  You are likely missing a slash at the end
> of a URL without a filename, and automatic redirection to correct your
> oversite is going to the effective ServerName or default vhost instead of
> to the host in the Host header.

Please dis-regard my last question about ServerName and ServerAlias.
I've answered my own question.... :)

Peace....

Tom

 
 
 

1. Apache 1.3.23/SSL named virtual host problems?

After upgrading to 1.3.23 and mod_ssl 2.8.7, I'm having trouble
configuring name-based virtual hosts under a single IP.  I've had this
configuration working under 1.3.22 so it should work but it doesn't.  So
I tried a fresh configuration and ran into problems with it too.  It's
probably my configuration but it possibly could be a newly introduced
bug.  The problem I'm seeing with the fresh configuration is that I have
to specify the port in the URL or it gets the wrong virtual host.  The
other problem that I see is that if I start using "apachectl startssl",
it doesn't start any httpd daemons whereas "apachectrl start" does.
Strange...   OS is RedHat 7.2 (2.4.16)

Robert

2. SC2000 hang. fast ethernet or NTP ?

3. Apache 1.3.23 syncronization problem

4. MIRAGE Z-128 & xf86config

5. Problems running Apache 1.3.23 on Solaris 8

6. Exception handling

7. Newbie Basic Config Problem - RH 7.3 + Apache 1.3.23

8. Phone # for ASUS, please.

9. problem with starting Apache 1.3.23

10. problem with 4.1.1, apache 1.3.23

11. Customs log problem with Apache/1.3.23

12. apache 1.3.23 mod_proxy proxy pass problem with swf files on Solaris 2.7

13. Apache 1.3.23, Linux 2.4 and Scatter/Gather NIC