Rob Brooks-Bilson
Tech, Photography, Stuff
Tech, Photography, Stuff
February 23, 2012
In my last blog post, I walked through the steps of installing ColdFusion 10 on Windows with Apache as the web server. I'm going to build on that in this post and show you how you can create additional ColdFusion instances and tie them to multiple virtual hosts in Apache (the multiple virtual hosts part is often referred to as multihoming).
For the purposes of this blog post, I'm going to assume that you've already installed ColdFusion 10 in the Server Configuration (Not EAR/WAR deployment). I'm also going to assume you chose to install Apache as your web server during the install process. This gives you a single instance of ColdFusion 10 (cfusion) with Apache connected to ColdFusion as localhost.
Now let's suppose I want to do two things. I want to have two instances of ColdFusion, cfusion (the default instance) and a new instance, cfusion2. For the cfusion instance I want two virtual hosts, one for localhost and one for zeus1.foo.com. For my cfusion2 instance, I want a single virtual host for zeus2.foo.com. Here are the steps to create that configuration. I'm doing this on a Windows install, but the basic process is the same across platforms. To visualize, the setup will look like this:
cfusion (instance 1) +--localhost +--zeus1.foo.comcfusion2 (instance 2) +--zeus2.foo.com
The first thing we need to do is create our new ColdFusion instance (cfusion2). To do this, we need to fire up the ColdFusion Administrator. Once logged in, click on the Instance Manager link in the Enterprise Manager section. Here you'll see a list of currently configured instances. To create a new instance, click the Add New Instance button:

Enter cfusion2 in the Server Name box. Leave the Server Directory as-is, and make sure to check the Create Windows Service box. When you're finished, click Submit.

It generally takes a few minutes for ColdFusion to create the instance. When it's finished, you'll see a screen with a link back to the Enterprise Manager. Go ahead and click the link once it appears:

Once you're back in the Instance Manager, you should see the new cfusion2 instance. Notice how the HTTP Port column shows 8500? This is because the new instance is setup to use Tomcat's built-in web server. Don't worry about that right now, we'll get to fixing that in just a minute. For now, just note the value in the Remote Port column for your cfusion2 instance as we'll be needing it shortly.

If you're wondering where ColdFusion 10 physically puts the directory structure for your instances, it's directly in the /ColdFusion10 install root:

With our two instances created, it's time to make some changes to ColdFusion's underlying Tomcat server configuration and Apache Tomcat connector configuration. We'll tackle the Tomcat configuration for the cfusion2 instance first. Fire up your favorite text editor and open the server.xml file located in:
C:\ColdFusion10\cfusion2\runtime\conf
About halfway down the file, you should see a line of XML that looks like this:
Verify that the Connector Port matches the Remote Port you noted earlier from the Instance Manager for the cfusion instance.
At the bottom of the file, you should see some additional XML that looks like this:
This code is used to configure Tomcat's built-in web server. Since we want to connect our ColdFusion instance to Apache, we need to disable this. To do that, simply comment it out and save the file:
Now that we've disabled the built-in web server, we need to tell Tomcat we want to use Apache as our web server instead. To do this, we have to make some changes to the Apache Tomcat connector ColdFusion previously installed. The connector and its associated configuration files can be found here:
C:\ColdFusion10\config\wsconfig\1
The connector itself is compiled and named mod_jk.so. There's not much to do with it other than to verify that it's there. The two files that we're interested in for our instance configuration are workers.properties and uriworkermap.properties.
The workers.properties file is used to configure your server instances. If you open it up in a text editor, you'll see that it's configured for your default cfusion instance:
To add our additional cfusion2 instance, we simply have to make two changes:
worker.list should contain a comma delimited list of all of the server instances you have. Below that, you need to configure the properties for each instance. You only need to concern yourself with the port here. Each ColdFusion instance gets its own port, which you can obtain from the Instance Manager in the ColdFusion Administrator.
Next, make a copy of your uriworkermap.properties file and name it uriworkermap_cfusion2.properties. The ColdFusion 10 docs tell you to rename it to uriworkermap1.properties, but I don't like that convention - especially if you have a lot of instances. Anyhow, change all of the mappings in the uriworkermap_cfusion2.properties file so that they apply to the cfusion2 instance. Here's how that should look:
That's it for the Apache Tomcat connector configuration. All that's left to do now is to setup our Apache virtual hosts, restart all of our servers and verify everything's working as expected.
Open your Apache http.conf file and notice that ColdFusion has placed the following directive at the bottom of the file:
Personally, I don't like the absolute path, so I usually make mine relative. I also like it in a subdirectory for virtual hosts. You don't have to move yours, it's just a personal preference of mine:
This directive tells Apache to load the mod_jk.conf configuration file that ColdFusion created when you told it to configure Apache as your web server.
Open your mod_jk.conf file and create the virtual hosts. Here's my mod_jk.conf file (I added some space and moved some things around to make it easier to read):
Note that for my cfusion instance where I want to have two virtual hosts, one for localhost and one for zeus1.foo.com, I've added the same jkmountfile directive to each virtual host like so:
All virtual hosts on a single instance should point to the same uriworkermap.properties file since that file specifies the mapping at the instance level.
For my cfusion2 instance, the single virtual host points to uriworkermap_cfusion2.properties:
That's it for configuration. Go ahead and stop and start both of your ColdFusion instances and your Apache web server just to make sure all changes are reflected.
Test out the URLs for each of your virtual hosts to make sure everything is pointing where it should be:
http://localhost http://zeus1.foo.com http://zeus2.foo.com Now open the ColdFusion administrator on localhost:
Everything should load up fine. In the Mappings section of the Administrator, /CFIDE and /gateway point to the correct locations:
Repeat the same process for your other virtual hosts, making sure the /CFIDE and /gateway mappings point to the correct locations for your instances.
That's it, you should now be configured for multiple instances of ColdFusion with multiple Apache virtual hosts.
February 21, 2012
Here's a quick visual walk through for installing ColdFusion 10 in Server Configuration with Apache as the web server on Windows.
Launch the installer, click next.

Accept the license terms, then click next.

Enter your serial number, choose the 30-Day Trial or Developer Edition. Click next.

Choose Server configuration. If you've installed other versions of ColdFusion in the past, you'll notice that there's no longer a Multi-Server option. This is because ColdFusion 10 has standardized the install/directory structure. The Server configuration creates a single, stand-alone instance of ColdFusion with Tomcat embedded as the JEE server. From there, you can create and configure additional instances of ColdFusion from withing the ColdFusion Administrator. To proceed, click Next.

Select the services you want installed and click next.

Enter a username and password for the remote server administration account. Click next.

A new feature in ColdFusion 10 will check the strength of the password you entered and make recommendations if it's found to be weak. Click yes if you want to modify the password you entered. If you want to ignore the warning and proceed, click No.

If you are installing ColdFusion 10 alongside a previous version, you may get a screen telling you that a previous version of the .Net service has been detected. Click next.

Select the directory where you want ColdFusion to install and click next.

It's now time to configure Apache as our web server. Click Add.

Select Apache as the web server.

Find the location of your Apache /conf directory:

Find the location of your Apache httpd.exe file:

Make sure everything is correct and click OK.

You should now have the configuration setup for Apache. Click next.

Enter a password to restrict access to the ColdFusion Administrator. Click next.

The password strength dialog may appear again. Click Yes to change your password or No to accept the one you just entered.

Choose whether or not you want to enable RDS. If you do enable it, provide a password. Click next when you are done.

You may get the password strength dialog again. Click Yes to change your password or No to accept the one you just entered.

If you want ColdFusion to automatically check for updates, check this box. This is a new feature in ColdFusion 10 and I highly recommend it. The check only occurs when you log into the ColdFusion Administrator. When you are done, click Next to proceed.

Review the information for the install. Click Install when you're ready to go.

The installer will now move through a series of screens highlighting features as the program installs.

You'll be greeted with a success message when the installer has completed. Click on the Done button to launch the ColdFusion Administrator and complete the install process.

You should now see the Configuration and Settings Migration Wizard in your browser. This step will completely your server configuration and migrate settings from any previous versions of ColdFusion the wizard detects. You'll need to enter the password you provided for the ColdFusion Administrator. Once you're ready, click Login.

You'll see a screen letting you know configuration is proceeding. The process can take several minutes.

When the process is complete, you can click Ok to launch the ColdFusion Administrator.

Congratulations, you've successfully installed ColdFusion 10 with Apache as your web server.
To see what changes ColdFusion 10 made to your Apache configuration, open your Apache http.conf file. You should see the following at the bottom of the file:
This directive tells Apache to load up the ColdFusion Tomcat/Apache connector configuration from an external file called mod_jk.conf. Go ahead and take a look at that file (I've added spacing to make it easier to read):
This file sets up various mapping and configuration options as well as maps the location for ColdFusion's /CFIDE directory. Note that it places /CFIDE inside of ColdFusion 10's default webroot. It's generally not a good idea to expose your /CFIDE directory to everyone. There are many ways to secure your /CFIDE directory. For specifics, see Pete Freitag's ColdFuion Lockdown Guide.
That's about it for the install. In my next post, I'll be showing how you can extend this installation to include multiple instances of ColdFusion, each with multiple Apache virtual hosts.
February 17, 2012
The title says it all. The much anticipated ColdFusion 10 (Zeus) has entered public beta and is available for download from Adobe Labs.
ColdFusion 10 represents a leap forward for ColdFusion with a nice combination of updated infrastructure and libraries as well as lots and lots of improvements to existing features. While they were at it the engineering team went ahead and added a slew of new features and language enhancements as well. Here's a small sampling of what's new:
This is just the tip of the iceberg. For a really nice overview of what's new from engineering team member Sagar Ganatra, check out his site.