Lucee can be installed on Windows/IIS very easily using the installer, but by default this will connect it to all of your IIS websites.
This may be appropriate if all or a large number of sites on the server require Lucee, but we prefer to enable it selectively for each individual site.
Doing so is pretty straightforward and I detailed the steps involved in a previous post written when I was first experimenting with Railo.
As that post was primarily about running ColdFusion and Railo together, I thought I'd separate out the steps we've continued to use even though we're now only running Lucee.
Prepare to install Lucee
There are a few things to check before running the installer to ensure things go smoothly.
- Ensure a Java JDK is installed, as opposed to a standard JRE (more details on Java download options from Oracle).
- Ensure you have a JAVA_HOME environment variable pointing to the JDK (Atlassian have some instructions).
- Ensure the .NET Framework 3.5 or higher and the .NET extensibility feature are both installed as part of IIS.
- In the IIS Manager, ensure Feature Delegation is enabled for "Handler Mappings". Check the Feature Delegation section under Management from the root IIS UI view:
This will allow the handlers to be individually customised for each Lucee site.
- In the IIS Manager UI, create an application pool for the Lucee powered website which uses .NET (as apposed to "no managed code") in "Integrated" pipeline mode.
- Assign your Lucee website to the above application pool using the Basic Settings dialogue panel.
Install Lucee without the BonCode connector
- Run the Lucee installer but de-select the option to install the BonCode IIS connector. The connector files will be copied into the Lucee root, but the auto-installer will not run.
- Once Lucee and Tomcat are installed, add a
<Host>entry for the new lucee website in [lucee-root]/tomcat/conf/server.xml, towards the bottom.
- Restart the Lucee/Tomcat service so that a WEB-INF folder is auto-created in the web root.
Copy the BonCode connector files
In the root folder* of the website to connect to Lucee, create a folder called BIN and copy the following files from the [lucee-root]/AJP13 folder:
(* i.e the document root folder of the host, even if the application uses a physical or virtual folder below that root. So if the app URL is lucee.dev/myapp, the BIN folder needs to go in the document root for lucee.dev.)
Add the handlers for the Lucee site
In the application's web root, ensure you have a web.config file containing the following BonCode handlers:
<?xml version="1.0" encoding="UTF-8"?> <configuration> <system.webServer> <handlers> <remove name="BonCode-Tomcat-CFM-Handler" /> <remove name="BonCode-Tomcat-CFC-Handler" /> <add name="BonCode-Tomcat-CFM-Handler" path="*.cfm" verb="*" type="BonCodeIIS.BonCodeCallHandler" modules="ManagedPipelineHandler" resourceType="File" requireAccess="Script" allowPathInfo="false" preCondition="integratedMode" /> <add name="BonCode-Tomcat-CFC-Handler" path="*.cfc" verb="*" type="BonCodeIIS.BonCodeCallHandler" modules="ManagedPipelineHandler" resourceType="File" requireAccess="Script" allowPathInfo="false" preCondition="integratedMode" /> </handlers> </system.webServer> </configuration>
If you use extensions other than .cfm and .cfc for Lucee, then you'll need to add handlers for those as well.
Adding further Lucee sites
To enable Lucee for another website, simply:
- Ensure the site is using an IIS App Pool with .NET/integrated pipeline enabled (could be the same pool as the others or one dedicated to the site/application).
- Add a copy of the BIN folder to the site's host root directory.
- Ensure the site's web.config file contains the Boncode CFM and CFC file handlers.
- Add a host entry for the site in Lucee's server.xml and restart.