Solved

Strange Virtual Hosting results

Posted on 2004-10-07
26
199 Views
Last Modified: 2010-03-04
I am using apache 2.0.40 on Red Hat 9 (Kernel: 2.4.20-28.9) with PHP 4.0 and Colfusion MX 6.1

What is happening is when I refresh one of the websites several times another site comes up which is also being hosted on the same system.

Sometimes when you browse randomly to a hosted website it will display another page. All the images and links are broken because it is displaying the wrong page but with the originally requested URL.......... eg I go to http://www.website1.com but it actually shows the website for http://www.website2.com and the images are broken with a link of http://www.website1.com/images/header_27.gif where that image doesn't exist for website1

An example of one of the VirtualHost entries in the httpd.conf file - they all look like this with the names changed of course.

Listen 80
NameVirtualHost *:80

<VirtualHost *:80>
DocumentRoot /home/website1/public_html
ServerName www.website1.com
DirectoryIndex index.html index.php index.cfm
HostNameLookups on
ErrorLog /home/website1/logs/error_log
CustomLog /home/website1/logs/access_log common
Options +Indexes
ServerAlias website1.com
</VirtualHost>

<VirtualHost *:80>
DocumentRoot /home/website2/public_html
ServerName www.website2.com
DirectoryIndex index.html index.php index.cfm
HostNameLookups on
ErrorLog /home/website2/logs/error_log
CustomLog /home/website2/logs/access_log common
Options +Indexes
ServerAlias website2.com
</VirtualHost>

I really hope someone can help with this since it is really starting to annoy my clients.

Thanks.
0
Comment
Question by:tumeki
  • 15
  • 11
26 Comments
 
LVL 15

Expert Comment

by:periwinkle
ID: 12248861
Hmmm - that almost sounds like a DNS issue where the secondary server isn't reporting the same IP address as the primary one.  Try going to:

http://www.dnsreport.com

and plugging in the domain names there - any problems reported?
0
 

Author Comment

by:tumeki
ID: 12253812
Thanks for the idea, but it didn't report anything unusual - a couple of warnings but they were just things like you only have 1 MX record etc.

Have double checked the DNS records on the servers and also the Hosts file and everything appears to be correct.

DNS example:

www.website1.com.   A    1.1.1.1
www.website2.com.   A    1.1.1.1
www.website3.com.   A    1.1.1.1

With the above mentioned VirtualHost records.
0
 
LVL 15

Expert Comment

by:periwinkle
ID: 12254078
This is one I haven't heard of before...

What does it say in the access_log and error_log when the wrong page comes up?  

Are you using mod_proxy?

I wonder if the HostNameLookups are causing the problem due to latency issues;  you might try turning that off, and using the logresolve utility instead as needed:

http://httpd.apache.org/docs-2.0/mod/core.html#hostnamelookups
0
 

Author Comment

by:tumeki
ID: 12254512
Yeah I thought it would be. I only found one other reference to it on the web and that didn't have an answer to the question.

In the access_log and error_log it only seems to complain about "File does nont exist" which is understandable.

No not using mod_proxy and have turned HostNameLookups off and it still seems to be doing the same thing.

A very strange problem.
0
 

Author Comment

by:tumeki
ID: 12254671
Can example of the problem.......... if you go to http://www.footpower.co.nz/ and refresh the page several times eventually you will see what I am talking about.
0
 
LVL 15

Expert Comment

by:periwinkle
ID: 12254687
Oh bizarre!  I see it!
0
 

Author Comment

by:tumeki
ID: 12254725
And in the error_log file for that website you get.............

[Fri Oct 08 12:42:05 2004] [error] [client x.x.x.x] File does not exist: /home/footpower/footpower/images/button_read_more.gif, referer: http://www.footpower.co.nz/
[Fri Oct 08 12:42:06 2004] [error] [client x.x.x.x] File does not exist: /home/footpower/footpower/images/black_corner_topleft.gif, referer: http://www.footpower.co.nz/
[Fri Oct 08 12:42:06 2004] [error] [client x.x.x.x] File does not exist: /home/footpower/footpower/images/black_bevel_top.gif, referer: http://www.footpower.co.nz/
[Fri Oct 08 12:42:06 2004] [error] [client x.x.x.x] File does not exist: /home/footpower/footpower/images/black_corner_topright.gif, referer: http://www.footpower.co.nz/
[Fri Oct 08 12:42:07 2004] [error] [client x.x.x.x] File does not exist: /home/footpower/footpower/images/black_corner_bottomleft.gif, referer: http://www.footpower.co.nz/

Which was someones attempt just now.
0
 
LVL 15

Expert Comment

by:periwinkle
ID: 12254743
What happens if instead of a global like:

<VirtualHost *:80>

you put in the actual IP address?  Might that fix the problem? <<-- clearly grasping at straws.
0
 
LVL 15

Expert Comment

by:periwinkle
ID: 12254762
probably mine - first two tuples of the IP address would be 206.105 .

Intriguingly, the error is pointing to the correct directory (I assume) for footpower, but I saw a couple of different sites when the page displayed.

What are the corresponding access_log entries?
0
 
LVL 15

Expert Comment

by:periwinkle
ID: 12254792
Hmmm -- could you try a slight variation on your configuration entries:

<VirtualHost xxx.xxx.xxx.xxx:80>
ServerName www.website2.com
ServerAlias website2.com
DocumentRoot /home/website2/public_html
DirectoryIndex index.html index.php index.cfm
HostNameLookups on
ErrorLog /home/website2/logs/error_log
CustomLog /home/website2/logs/access_log common
<Directory /home/website2/public_html>
Options +Indexes
order allow,deny
allow from all
</Directory>
</VirtualHost>

where xxx.xxx.xxx.xxx is the actual IP address?
0
 

Author Comment

by:tumeki
ID: 12255062
Sorry to say that doesn't seem to have made any difference.

Looking in the error_log file it has......

[Fri Oct 08 13:15:14 2004] [error] [client x.x.x.x] File does not exist: /home/footpower/footpower/images/black_corner_bottomright.gif, referer: http://www.footpower.co.nz/
[Fri Oct 08 13:17:51 2004] [error] [client x.x.x.x] File does not exist: /home/footpower/footpower/css/cabletalk.css, referer: http://www.footpower.co.nz/
[Fri Oct 08 13:17:51 2004] [error] [client x.x.x.x] File does not exist: /home/footpower/footpower/images/left_dropfade.gif, referer: http://www.footpower.co.nz/

and in the access_log file it has.........

x.x.x.x - - [08/Oct/2004:13:17:50 +1300] "GET /images/vertical_dotted_line.gif HTTP/1.1" 304 -
x.x.x.x - - [08/Oct/2004:13:17:50 +1300] "GET / HTTP/1.1" 200 14696
x.x.x.x - - [08/Oct/2004:13:17:51 +1300] "GET /css/cabletalk.css HTTP/1.1" 404 1204

Maybe this has something to do with it........... in the /var/log/httpd/error_log I have thousands of these.

[Fri Oct 08 13:12:27 2004] [notice] jrApache[init] JRun 4.0 (Build 63961) Apache 2 module - Oct  8 2004 12:24:06
[Fri Oct 08 13:12:28 2004] [notice] Apache/2.0.40 (Red Hat Linux) configured -- resuming normal operations
[Fri Oct 08 13:14:29 2004] [notice] caught SIGTERM, shutting down
[Fri Oct 08 13:14:31 2004] [notice] jrApache[init] JRun 4.0 (Build 63961) Apache 2 module - Oct  8 2004 12:24:06
[Fri Oct 08 13:14:31 2004] [notice] Digest: generating secret for digest authentication ...
[Fri Oct 08 13:14:31 2004] [notice] Digest: done
[Fri Oct 08 13:14:32 2004] [notice] jrApache[init] JRun 4.0 (Build 63961) Apache 2 module - Oct  8 2004 12:24:06
[Fri Oct 08 13:14:32 2004] [notice] Apache/2.0.40 (Red Hat Linux) configured -- resuming normal operations
[Fri Oct 08 13:16:47 2004] [notice] caught SIGTERM, shutting down
[Fri Oct 08 13:16:48 2004] [notice] jrApache[init] JRun 4.0 (Build 63961) Apache 2 module - Oct  8 2004 12:24:06
[Fri Oct 08 13:16:48 2004] [notice] Digest: generating secret for digest authentication ...
[Fri Oct 08 13:16:48 2004] [notice] Digest: done

0
 
LVL 15

Expert Comment

by:periwinkle
ID: 12255125
hmmm - SIGTERM is the signal to shutdown... but it looks like it's just the JRUN module, not Apache itself (although I could be wrong...)
0
 
LVL 15

Expert Comment

by:periwinkle
ID: 12255133
Looking at those log entries for the site, it is *definitely* confused about what site it is supposed to be showing!  
0
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 

Author Comment

by:tumeki
ID: 12255216
Could there be something in the conf file that I am missing........... I don't really want to post the whole conf file here.

There has been very little change to the conf file apart from adding some Virtual Hosts and the usual stuff, so don't know what it could be.
0
 
LVL 15

Expert Comment

by:periwinkle
ID: 12255229
Is it happening across the board, or only to certain sites?
0
 

Author Comment

by:tumeki
ID: 12255260
It's happening across the board. This system is hosting about 10 websites.

Also have just noticed on sites that have a home link which points to index.cfm it will cause the problem then as well.

For example: If I go to www.footpower.co.nz surf around the site for a bit and then click on home........ it sometimes brings up another website with the broken links.
0
 
LVL 15

Accepted Solution

by:
periwinkle earned 500 total points
ID: 12255275
Did this always happen, or did it happen after adding a particular virtual host?

index.cfm seems to say that perhaps the problem occurs only with ColdFusion pages?  Does it make a difference if you use a static .html page?
0
 
LVL 15

Expert Comment

by:periwinkle
ID: 12255301
Found this -- are you using SuSE Linux?

http://archive.apache.org/gnats/8148
0
 
LVL 15

Expert Comment

by:periwinkle
ID: 12255307
0
 
LVL 15

Expert Comment

by:periwinkle
ID: 12255327
D'oh, you say RedHat.  Here's someone who had the same problem on RedHat:

https://www.redhat.com/archives/valhalla-list/2002-September/msg02711.html
0
 

Author Comment

by:tumeki
ID: 12255335
Nah using RedHat 9.0

But I think you may have hit the nail on the head with the above "Did this always happen, or did it happen after adding a particular virtual host?"

As a total off chance I removed all the Virtual Hosts and then one by one putting them back on and seeing which one breaks it.

Still doing this now, will let you know how it goes.
0
 

Author Comment

by:tumeki
ID: 12255407
Thanks so much for all your help........ you got it...... it helps bouncing ideas of people.

It was a particular VirtualHost that was causing problems.

Now I have to work out why it is causing problems.
0
 

Author Comment

by:tumeki
ID: 12255802
How annoying - I jumped the gun a bit there......... it hasn't made any different :(

Thought it was good when I removed a particular VirtualHost, but leaving it for awhile it has happened again without that VH in place.
0
 

Author Comment

by:tumeki
ID: 12255976
Ok if anyone gets this same problem check this article out...............

http://www.experts-exchange.com/Web/WebDevSoftware/ColdFusion/Q_20563247.html

It is a ColdFusion specific thing.
0
 
LVL 15

Expert Comment

by:periwinkle
ID: 12257783
Oh yahoo!  Is it fixed now?
0
 
LVL 15

Expert Comment

by:periwinkle
ID: 12257829
Ah, for posterity:

CFMX is configured to cache pages that are of the same name, even when in a multi-homed environment. This function can be turned off, and is described here:

http://www.macromedia.com/support/coldfusion/ts/documents/tn18258.htm

Good find!
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

Suggested Solutions

As Wikipedia explains 'robots.txt' as -- the robot exclusion standard, also known as the Robots Exclusion Protocol or robots.txt protocol, is a convention to prevent cooperating web spiders and other web robots from accessing all or part of a websit…
If you've heard about htaccess and it sounds like it does what you want, but you're not sure how it works... well, you're in the right place. Read on. Some Basics #1. It's a file and its filename is .htaccess (yes, with a dot in the front). #…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now