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>
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>
Thank You,
Jim Weller
University of Alaska Anchorage