Catalyst+IIS 7.0 on MS Windows 2008/Vista

This article describes deployment of Catalyst application on a Microsoft Windows 2008 or Vista + IIS 7.0 (Internet Information Service).

VERY IMPORTANT: you need at least Catalyst::Runtime 5.80005 to run Catalyst applications as FastCGI on Windows 2008.

First you need Perl + Catalyst framework

See Catalyst+Apache+FastCGI on MS Windows

Let us assume we have our perl installed in

c:\strawberry\

or

c:\perl\

Install your Catalyst application

See Catalyst+Apache+FastCGI on MS Windows

Let us assume we have our application in

c:\inetpub\WebApp\

or any folder on your hard drive such as :-

c:\CatalystApp\

Install IIS server role with FastCGI support

On Windows 2008 installing IIS means adding appropriate server role. To do this go to Control Panel > Administrative Tools > Server Manager:

Under Server Manager, right click 'Roles' - choose 'Add Roles'.

window title:Server Manager, right click 'Roles' - choose 'Add Roles'

Add Roles Wizard, check 'Web Server (IIS)' - click 'Next'

window title:Add Roles Wizard, check 'Web Server (IIS)' - click 'Next'

IMPORTANT If you have already got your server role set up as Web Server (IIS), as shown in the screen shot, ignore those steps!

It is very important to select CGI Role Service to install (this includes also FastCGI support):

You can add CGI / FastCGI support to your server role as follows.. (You may already have this, especially if you are set up and running PHP)

Right click Web Server (IIS) under 'Roles' and select 'Add Role Services'

window title:Add Role Services, Right click 'Web Server (IIS)' - click 'Add Role Services'

When the wizard refreshes, under 'Application Developement', tick 'CGI' and use the wizard to install the service.

window title:Add Roles Wizard - check 'CGI' - click 'Next'

Now go to Control Panel > Administrative Tools > Internet Information Services (IIS) Manager and choose Add Web Site like this:

window title:Internet Information Services (IIS) Manager

Fill in appropriate site name, document root and IP+port (or leave 'All Unassigned' if not required) and click OK.

windows title:Add Web Site, fill 'Site name' = e.g. 'My Catalyst App', fill 'Physical path' = c:\inetpub\WebApp\root, set 'Port' = e.g. 4000 - click OK

Make sure your 'Physical Path' points the the 'root' folder of your application folder!

Click on our newly created site in left column and then on Handler Mappings icon:

window title:Internet Information Services (IIS) Manager, click on 'Handler Mappings' icon

Click on Add module mapping in right column:

window title:Add Module Mapping

Note If you are inheriting from parent, you will see a lot of already configured mappings (as per screen shot), if you wish to remove these you can.

However, you have to delete them manually, one at a time. You can then configure just the mappings you require.

Don't panic, if you mess things up and want to 're-inherit', use the 'Revert To Parent' option below 'Add Module Mapping'.

Remember you will then need to re-add the following mappings.


Fill required info like in the following example.

window title:Add Module Mapping, fill 'Request path'=*, fill 'Module'=FastCgiModule, fill 'Executable (optional)', fill 'Name'=CatalystFastCGI - click OK

Important: executable is set to

c:\strawberry\perl\bin\perl.exe|c:\inetpub\WebApp\script\webapp_fastcgi.pl -e

or

c:\perl\bin\perl.exe|c:\CatalystApp\script\CatalystApp_fastcgi.pl -e

Make sure there are no spaces either side of the pipe and one before '-e' on the end!

In the next dialogue confirm YES:

windows title:Confirm Add Module Mapping

Now you can see the new handler "CatalystFastCGI" in the list like this:

window title:Internet Information Services (IIS) Manager - Mapping Added

Click on your "CatalystApp" site in left column and then on Restart on right hand side.

window title:Internet Information Services (IIS) Manager - Restart CatalystApp Website

Test your application

At this point your Catalyst application should be available at

http://localhost:4000

or

http://catalystapp.mydomain.com:4000

window title:Catalyst Application Running

Don't forget to set up any DNS records you might need for public access!

Static Files (Catalyst)

You may notice (as per screen shot above) that the Catalyst logo isn't being displayed, this is because you still need to set up your application to serve static files.

You need to edit the CatalystApp.pm module located in the 'lib' directory of your application main directory (e.g. C:\CatalystApp\lib).

Then locate the ->config method and ensure you have the line highlighted below.

window title:Catalyst Static File Parsing

You can change (images|css|js) to any pipe delimited list of sub folders in the 'static' folder you would like to include.

Static Files (IIS Web Server)

You can remove the static file option above from your CatalystApp.pm module and follow the instructions below for URL Path Controller / Action Routing.

This method means it is IIS7 serving the static files and not your Catalyst application!

Note : Ensure you have the Static Content Role Service installed for your Web Server (IIS)

window title:Web Server (IIS) Static File Service

Very Important : Only remove the static file option if you plan to develop over IIS, if you still wish to run the built in application development server you will need to keep the static file option in order to have the development server handle static files!

URL Path Controller / Action Routing

VERY IMPORTANT NOTICE

You may find that once you start to build your application that the URL path mapping to controller/action isn't working, nor is it serving static files correctly.

If you experience this problem, you will need to edit the same ->config method above in the CatalystApp.pm main application module and add the following line.

window title:Catalyst URL Path Controller / Action Routing

Read more about Catalyst configuration settings.

My tags:
 
Popular tags:
 
Powered by Catalyst
Powered by MojoMojo Hosted by Shadowcat - Managed by Nordaaker