On my development machine, I run ColdFusion 7 in ‘multi-server’ mode. This comes in handy if you need to create a separate instance of ColdFusion because of needs of a project or client. I also run Apache as my web server. While I am not a big fan of the httpd.conf file (mostly out of lack of familiarity), it makes it a lot easier to run multiple web sites on Windows XP. (Yes, I know there are tools that allow you to do this with IIS, but all the ones I have tried have been buggy and made messing with httpd.conf a pleasant experience). I also add sites to my HOSTS file and give them a ‘domain’ of ‘dev’ (boyzoid.dev, for example). This makes it easier for me to keep track of which environment I am in, and in a lot of cases, save some typing as I usually abbreviate the project (mic.dev, for example).
Like most ColdFusion developers, I wanted to play with ColdFusion 8 when it went into public beta. I wanted to be able to use ColdFusion 8 and not have to deviate much from my development practices. I wound up installing ColdFusion 8 as a .ear file and deploying it to the same instance of JRun on which ColdFusion 7 is running. This way I could manage all my ColdFusion instances in one place. I ran into one small problem though, how do I get a site configured in Apache to use the ColdFusion 8 server rather than the ColdFusion 7 server? For those who may not know, when you are using IIS and multiserver install of ColdFusion, when you add news ‘sites’ to IIS, you ccan specify what instance of ColdFusion to use for the site. The answer was surprisingly simple.
First, keep in mind these instructions pick up AFTER ColdFusion 8 has been installed and deployed to your JRun server and the server is running. It also assumes that Apache has already been configured to work with ColdFusion
- Go into your JRun Admin and find the ‘server’ you specified when you deployed ColdFusion 8, and click the link. In my case, its named ‘cf8’.
- In the resulting screen, click the ‘Services’ link in the navigation bar.
- In the next screen, click the ‘Start’button next to the ‘Proxy Service’. Take note of the ‘proxy port’, we will need that in a bit.
- Create a directory, with whatever name you woud like) under {Jrun}/lib/wsconfig (In my case, I named it ‘cf8’…original, I know)
- Open up httpd.conf and create a <virtualHost> to use, or you can use an existing one.
- In httpd.confand look for a block of code that looks like:
# JRun Settings LoadModule jrun_module "C:/JRun4/lib/wsconfig/1/mod_jrun20.so" <IfModule mod_jrun20.c> JRunConfig Verbose false JRunConfig Apialloc false JRunConfig Ssl false JRunConfig Ignoresuffixmap false JRunConfig Serverstore "C:/JRun4/lib/wsconfig/1/jrunserver.store" JRunConfig Bootstrap 127.0.0.1:51020 #JRunConfig Errorurl <optionally redirect to this URL on errors> #JRunConfig ProxyRetryInterval 600 #JRunConfig ConnectTimeout 15 #JRunConfig RecvTimeout 300 #JRunConfig SendTimeout 15 AddHandler jrun-handler .jsp .jws .cfm .cfml .cfc .cfr .cfswf </IfModule>
This information is what Apache uses to pass off requests to ColdFusion.
- Copy the following lines:
JRunConfig Apialloc false JRunConfig Serverstore "C:/JRun4/lib/wsconfig/1/jrunserver.store" JRunConfig Bootstrap 127.0.0.1:51020
- Paste the above lines inside the <virtualHost> block you created, or chose, in step 6.
- In the line: JRunConfig Serverstore “C:/JRun4/lib/wsconfig/1/jrunserver.store”, change the path so it matches the path of the directory you created in step 4. Make sure you keep the ‘/jrunserver.store‘ on the end. Don;t worry about the file not being there, it will get added auto-magiaclly.
- In the line JRunConfig Bootstrap 127.0.0.1:51020, replace the port number (the number after the colon) with the ‘proxy port’ number we noted in step 3.
- Restart Apache.
The <virtualHost> you created will now use ColdFusion 8 instead of the default server (which in my case was ColdFusion 7).
How do we know its using ColdFusion 8? Easy, just create a test page with <cfdump var=”#server#” />, you’ll see a version number that begins with ‘8’.
You can also use this method for pointing Apache to different instances of the same version of ColdFusion, since, as far as JRun cares, they are all just servers.
Comments on: "Running CF8 & CF 7 on JRun with Apache" (4)
Hi Scott,
Thanks for showing me how to run CF7 and CF8 on the same machine. The only trouble I’m having is being able to access the CF8 administrator. I created a virtual host called localhost.cf8 and I can get to the administrator by going to http://localhost.cf8/CFIDE/administrator/index.cfm, but all of the images have broken paths. Any tips on a better way to do this??
LikeLike
@Tony – I typically just use the port number assigned from JRun (should start at 8300). So for instance, you should be able to access your CF8 admin by using localhost:8301 (check the JRun admin to see what port number is assigned to the instance)
LikeLike
Yep — that worked. Thanks again!
LikeLike
Hi Scott
I’m just wondering what version of Apache were you using? I have 2.2.6 running on Leopard and I am trying to install Coldfusion 7. I have yet to try 8 but more people have had success with 8. Hardly anything on CF 7 and this version of apache.
An error appears on installation saying that it does not support the version 2.2.6 (only certain versions of 1.x and 2.x)
I might just have to install CF8, however, if you know of a fix (without changing the version of apache), I would appreciate your help.
Thanks.
LikeLike