Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Coldfusion not working with Apache Virtual Hosts

177 views
Skip to first unread message

bigreddastud

unread,
Jan 10, 2005, 4:26:48 PM1/10/05
to
I've upgraded my server to a new box, and in the process decided to migrate
from IIS to Apache webserver. Coldfusion works fine without Apache virtual
hosts (ie one webste) but when I setup for multiple sites using virtual hosts,
CF starts acting weird. The server will intermittently send content from the
wrong document root from the other site!

Example: calling up www.domain1.com get you domain2.com's homepage

This is not completely random from what I've found. Usually whichever domain
I call first is the documents CF tries to server up. It's like it's caching
the index.cfm files and won't recognize the virtual hosts. After a while,
I'll call the other domain, and that one seems to in effect become cached
within the CF server. The problem is DEFINITELY within Coldfusion since
calling regular index.htm files results in 100% accuracy. Only when I call the
*.cfm pages does it get confused and start sending from the wrong document
roots.

I dumped my CGI vars and the CF_TEMPLATE_PATH variable seems to get "stuck" in
one docroot. If I call Domain1.com (and the first one's sent correctly) but
then immediately thereafter call domain2.com it'll send the wrong page. Also I
can tell which site's page I'm going to get by looking at the dumped
CF_TEMPLATE_PATH variable even though EVERY other CGI variable points to the
correct virtual host.

How can I fix this? Do I have to spawn 2 Jrun servers (one for each
virtualhost)? Please help ASAP!

I attached my Apache httpd.conf file for virtual hosts:

# www.domain1.com host
<VirtualHost *>
ServerAdmin webm...@domain1.com
ServerAlias *.domain1.com
DocumentRoot D:\inetpub\wwwroot\domain1_com
ServerName domain1.com
ErrorLog logs\domain1.com-error_log
CustomLog logs\domain1.com-access_log common

#aliases

Alias /cfadmin "D:\InetPub\wwwroot\ColdFusionMX\CFIDE\administrator"
#Alias /mailroot
#Alias /rome

</VirtualHost>

# www.domain2.com host
<VirtualHost *>
ServerAdmin webm...@domain2.com
ServerAlias *.domain2.com
DocumentRoot D:\inetpub\wwwroot\domain2_com
ServerName domain2.com
ErrorLog logs\domain2.com-error_log
CustomLog logs\domain2.com-access_log common

</VirtualHost>

bigreddastud

unread,
Jan 11, 2005, 2:55:53 PM1/11/05
to
OK, I've fixed my problem.

I needed to have the CF module loading for each virtual host instead of as a
site wide directive. In order to fix this I put the <IfModule> code in each
virtual host definition. Just copy/paste it from the main server section into
all virtual hosts.

This is not really stated anywhere much that I could find. I saw several
places (one here at Macromedia too) that showed setting up multiple instances
of the CF Server, but none that I found really enumerated details on my simple
situation. I've documented it here as an FYI to others:


# www.domain1.com host
<VirtualHost *>
ServerAdmin webm...@domain1.com
ServerAlias *.domain1.com
DocumentRoot D:\inetpub\wwwroot\domain1_com
ServerName domain1.com
ErrorLog logs\domain1.com-error_log
CustomLog logs\domain1.com-access_log common

#aliases

Alias /cfadmin "D:\InetPub\wwwroot\ColdFusionMX\CFIDE\administrator"
#Alias /mailroot
#Alias /rome

<IfModule mod_jrun20.c>
JRunConfig Verbose false
JRunConfig Apialloc false
JRunConfig Ignoresuffixmap false
JRunConfig Serverstore
"C:/CFusionMX/runtime/lib/wsconfig/1/jrunserver.store"
JRunConfig Bootstrap 127.0.0.1:51010
#JRunConfig Errorurl <optionally redirect to this URL on errors>
AddHandler jrun-handler .jsp .jws .cfm .cfml .cfc
</IfModule>

</VirtualHost>

# www.domain2.com host
<VirtualHost *>
ServerAdmin webm...@domain2.com
ServerAlias *.domain2.com
DocumentRoot D:\inetpub\wwwroot\domain2_com
ServerName domain2.com
ErrorLog logs\domain2.com-error_log
CustomLog logs\domain2.com-access_log common

<IfModule mod_jrun20.c>
JRunConfig Verbose false
JRunConfig Apialloc false
JRunConfig Ignoresuffixmap false
JRunConfig Serverstore
"C:/CFusionMX/runtime/lib/wsconfig/1/jrunserver.store"
JRunConfig Bootstrap 127.0.0.1:51010
#JRunConfig Errorurl <optionally redirect to this URL on errors>
AddHandler jrun-handler .jsp .jws .cfm .cfml .cfc
</IfModule>

</VirtualHost>

jim.w...@gmail.com

unread,
Mar 1, 2005, 4:07:55 PM3/1/05
to
bigreddastud,
Thank you. Thank you. Thank you. This problem has been plagueing us for
months. We have a complicated architecture and fingers were being
pointed every which way. This message clearly identified our problem.
The solution made the problem disappear immediately. Very astute
observation about .cfm caching.

Thank You,
Jim Weller
University of Alaska Anchorage

0 new messages