CFML – Helicon Tech Blog http://www.helicontech.com/articles Web Server Enhancements Fri, 16 Nov 2012 16:00:25 +0000 en-US hourly 1 https://wordpress.org/?v=5.2.4 Running Railo on Windows with IIS in production http://www.helicontech.com/articles/running-railo-on-iis-in-production/ Tue, 29 May 2012 14:38:27 +0000 http://www.helicontech.com/articles/?p=1040 Continue reading ]]> Railo is a free, open source CFML engine, that  is released under the GNU license. It is known to be highly performing and supported CFML engine available.  Most existing ColdFusion applications will work on it. This article provides simple instructions how to install Railo on IIS web server in production. This solution can be used to run CFML applications on your Windows servers or provide CFML hosting to others.

Environment installation

First we need to configure the Windows server to run CFML applications. Please follow these instructions:

  1. Download and install Microsoft Web Platform Installer.
  2. Run Web Platform Installer and click “Options”.
  3. Add Helicon Zoo feed into “Display additional scenarios” box: http://www.helicontech.com/zoo/feed. New “Zoo” tab will appear.
  4. Go to the Zoo –> Engines and install Railo 3 or Railo 4 (or both).

    image

    Alternatively you can install Zoo –> Packages –> CFML Hosting Package. This will install both Railo 3 and 4 and all other requirements to host CFML applications on IIS.

    image

  5. Accept licenses to start installation process.

All required packages and dependencies will be downloaded and installed. Whole installation process may take time. After installation is completed your server is ready to run CFML applications as usual IIS web sites.

Usage

To create new Railo web site you can use Web Platform Installer again. Go to Zoo –> Templates and install Railo 3 or Railo 4 project.

image

You can set either IIS or IIS Express as target environment for this project and if you have not installed CFML Hosting Package, then all required dependencies will be installed automatically. After installation is completed Railo web site will start working immediately.

railo-start-page

If you want to create Railo web site manually, please add an empty IIS web site for your application:

 

new-site-iis

Create web.config file in the web site folder and put the following content into it:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <system.webServer>
    <heliconZoo>
      <application name="railo.project">
        <environmentVariables>
        </environmentVariables>
      </application>
     </heliconZoo>
    <handlers>
      <add name="railo.project#x86.cfm"   scriptProcessor="railo" 
        path="*.cfm"   verb="*" modules="HeliconZoo_x86" 
        preCondition="bitness32" resourceType="Unspecified" 
        requireAccess="Script" />
      <add name="railo.project#x86.cfc"   scriptProcessor="railo" 
        path="*.cfc"   verb="*" modules="HeliconZoo_x86" 
        preCondition="bitness32" resourceType="Unspecified" 
        requireAccess="Script" />
      <add name="railo.project#x86.cfml"  scriptProcessor="railo" 
        path="*.cfml"  verb="*" modules="HeliconZoo_x86" 
        preCondition="bitness32" resourceType="Unspecified" 
        requireAccess="Script" />
      <add name="railo.project#x86.cfr"   scriptProcessor="railo" 
        path="*.cfr"   verb="*" modules="HeliconZoo_x86" 
        preCondition="bitness32" resourceType="Unspecified" 
        requireAccess="Script" />
      <add name="railo.project#x86.cfswf" scriptProcessor="railo" 
        path="*.cfswf" verb="*" modules="HeliconZoo_x86" 
        preCondition="bitness32" resourceType="Unspecified" 
        requireAccess="Script" />
      
      <add name="railo.project#x64.cfm"   scriptProcessor="railo" 
        path="*.cfm"   verb="*" modules="HeliconZoo_x64" 
        preCondition="bitness64" resourceType="Unspecified" 
        requireAccess="Script" />
      <add name="railo.project#x64.cfc"   scriptProcessor="railo" 
        path="*.cfc"   verb="*" modules="HeliconZoo_x64" 
        preCondition="bitness64" resourceType="Unspecified" 
        requireAccess="Script" />
      <add name="railo.project#x64.cfml"  scriptProcessor="railo" 
        path="*.cfml"  verb="*" modules="HeliconZoo_x64" 
        preCondition="bitness64" resourceType="Unspecified" 
        requireAccess="Script" />
      <add name="railo.project#x64.cfr"   scriptProcessor="railo" 
        path="*.cfr"   verb="*" modules="HeliconZoo_x64" 
        preCondition="bitness64" resourceType="Unspecified" 
        requireAccess="Script" />
      <add name="railo.project#x64.cfswf" scriptProcessor="railo" 
        path="*.cfswf" verb="*" modules="HeliconZoo_x64" 
        preCondition="bitness64" resourceType="Unspecified" 
        requireAccess="Script" />
    </handlers>
    <defaultDocument>
      <files>
        <remove value="index.cfm" />
        <add value="index.cfm" />
      </files>
    </defaultDocument>
  </system.webServer>
</configuration>

This will enable Railo 3 to process requests for the registered file extensions in this IIS web application folder. To use Railo 4 set scriptProcessor=”railo.4″ instead. As there is no currently application files in this folder navigating to the root of the web site will trigger 403 error. So please navigate to the http://localhost/railo-context/admin.cfm to open Railo administration interface. For the first start you will be asked to create server and web administrator passwords.

After that you may just put your CFML application into this IIS web site folder.

Manual installation

Sometimes you may need to install specific version of Railo, or you may only want to install Railo for a specific IIS web site instead of installing it on a server globally. There could be a case when your hosting service does nto provide Railo support, but instead has support for generic Java applications. In this situation please follow this instruction:

If you are installing on your own server first you need to follow first three steps from “Environment install” chapter to get Helicon Zoo feed in Web Platform Installer. Now go to Zoo –> Packages and install Java Hosting Package. This will install support for generic Java applications for IIS.

zoo-packages-java

Then go to the Railo Download page and get the WAR archive distribution version. Put this WAR file into IIS web site root folder and create a web.config file there with the following content:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <system.webServer>
    <heliconZoo>
      <application name="jetty.project" >
        <environmentVariables>
          <!-- Uncomment line below if you want to set contexts directory -->
          <!--  <add name="CONTEXTS_DIR" value="%APPL_VIRTUAL_PATH%" /> -->

          <!-- Optional variables: -->
          <!-- <add name="CONTEXT_PATH" value="%APPL_VIRTUAL_PATH%" /> -->
          <!-- <add name="WAR_EXTRACT_PATH" value="%APPL_PHYSICAL_PATH%" /> -->

          <!-- A WAR file or start directory to run -->
          <add name="WAR_FILE" value="railo-3.3.1.000.zip" />
        </environmentVariables>
        </application>
    </heliconZoo>

        <handlers>
          <add name="jetty.project#x86" scriptProcessor="java.jetty" 
            path="*" verb="*" modules="HeliconZoo_x86" 
            preCondition="bitness32" resourceType="Unspecified" 
            requireAccess="Script" />
          <add name="jetty.project#x64" scriptProcessor="java.jetty" 
            path="*" verb="*" modules="HeliconZoo_x64" 
            preCondition="bitness64" resourceType="Unspecified" 
            requireAccess="Script" />
        </handlers>
  </system.webServer>
</configuration>

Note the name of the file here is railo-3.3.1.000.zip. You may need to change it if your version of Railo is different. Also as you can see handlers are mapped to the asterisk – “*”, which mean every request to this web site will be processed by Java, including static files. Sometimes this is a good idea, especially if you are using some kind of URL rewriting or request filtering tools in your Java or CFML application. We have chosen to use asterisk map as it is more generic and will provide better application compatibility. But if you feel confident in server configuration, mapping handlers to specific file extensions (as it is done in web.config from automatic installation chapter) will give you some performance points, as static files will be processed directly by IIS.

Now you can navigate your browser to the web site root, which will bring you Railo welcome page. Then simply put your CFML application in this IIS web site folder to start working with Railo!

]]>
Installing Open Blue Dragon on Windows with IIS. http://www.helicontech.com/articles/installing-open-blue-dragon-on-iis/ Thu, 19 Apr 2012 11:27:16 +0000 http://www.helicontech.com/articles/?p=915 Continue reading ]]> OpenBD (Open Blue Dragon) is a powerful open-source CFML engine. Here we are going to show you how to deploy it on IIS with the help of Helicon Zoo.

Environment installation

First we need to configure our Windows server to run Java Servlet applications. This is easily doable using following instructions.

  1. Download and install Web Platform Installer.
  2. Run Web Platform Installer and click “Options”.
  3. Add Helicon Zoo feed into “Display additional scenarios” box:  http://www.helicontech.com/zoo/feed. New “Zoo” tab will appear.
  4. Go to the Zoo -> Packages and install Java Hosting Package.
  5. Accept licenses to start installation process.

 

     

    Alternatively, instead of installing Java Hosting Package you can install Modules –> Helicon Zoo Module and Engines –> Jetty separately. This is minimal requirement to run Java Servlet applications under Microsoft IIS web server. If you want to run Java Servlets under IIS Express and WebMatrix in your development environment, then you will also need to install Helicon Zoo Module for IIS Express form Engines section.

     

    This is enough configuration to run most of Java Servlet applications directly form IIS.

OpenBD installation

Download “J2EE Standard WAR” on http://www.openbluedragon.org/download/. Launch IIS Manager and create new web-site or an application. Copy downloaded .war file into your web-site’s or application’s root folder and create the following web.config:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <system.webServer>
    <heliconZoo>
      <application name="openbd.project" >
        <environmentVariables>
          <!-- Uncomment line below if you want to set contexts directory -->
          <!--  <add name="CONTEXTS_DIR" value="%APPL_VIRTUAL_PATH%" /> -->

          <!-- Optional variables: -->
          <!-- <add name="CONTEXT_PATH" value="%APPL_VIRTUAL_PATH%" /> -->
          <!-- <add name="WAR_EXTRACT_PATH" value="%APPL_PHYSICAL_PATH%" /> -->

          <!-- A WAR file or start directory to run -->
          <add name="WAR_FILE" value="openbd.zip" />
        </environmentVariables>
        </application>
    </heliconZoo>

        <handlers>
          <add name="openbd.project#x86" scriptProcessor="java.jetty"
            path="*" verb="*" modules="HeliconZoo_x86"
            preCondition="bitness32" resourceType="Unspecified"
            requireAccess="Script" />
          <add name="openbd.project#x64" scriptProcessor="java.jetty"
            path="*" verb="*" modules="HeliconZoo_x64"
            preCondition="bitness64" resourceType="Unspecified"
            requireAccess="Script" />
        </handlers>
  </system.webServer>
</configuration>

Please take a look at <environmentVariables> section. Only “WAR_FILE” variable is required and should contain either path to a WAR file or to a folder containing unpacked Java Servlet application.
WAR_EXTRACT_PATH variable can be used to configure location where to unpack WAR file content. By default it is IIS application root folder. CONTEXT_PATH variable needed by Java application and contains IIS application virtual path by default.

WARNING: Since WAR files need to be extracted before execution you will need to have a folder with write permissions.  In default IIS installation all application pools are executed with permissions of IIS_IUSRS group which does not have write permissions to the web application folders. You will need to provide write permissions to the user running Application Pool or IIS_IUSRS group to the folder containing OpenBD application or specify other folder using WAR_EXTRACT_PATH variable with write permissions provided.

That’s it. You may now start OpenBD by opening IIS web site in the browser:

You can copy CFML applications into “webapps” folder of OpenBD web site. There are “manual” and “bluedragon” already. The latter one is actually an administration panel for your OpenBD installation:

Resume

As you can see we’ve installed OpenBD easily in very few steps. Naturally you may deploy any .war file in the same way.
Cheers 🙂

]]>