Zoom Search Engine FAQ - Setting up CGI support on IIS

Q. I need help setting up binary CGI support for my Windows IIS server

Zoom Search Engine's CGI option provides the best performance for searching your website but it can be tricky to enable CGI support on IIS servers for the first time.

Your IIS server may not be configured for executing binary CGIs. Note that this is not the same as having Perl support. You will need to contact your web host or have direct access to the server to change this by following the instructions below.

This procedure is different for various versions of IIS. Please skip to the section that corresponds to the version of IIS and Windows you are using.

IIS 5.0 or earlier

First, you will need to access the IIS window on the web server (Control Panel -> Administrative Tools -> Internet Information Services). Next, locate the folder for your website, and select the folder where you will be running the CGI file. You can possibly create a new folder here (eg. "cgi-bin") or select an existing folder where you will be uploading your search files to (eg. "search"). Right click on the folder, and select "Properties". Now look for "Execute Permissions" and change the setting to "Scripts and Executables".

If the "Configuration" button is enabled, you can click on it to check if the ".cgi" extension is mapped to an application. If not, then it should be fine for the CGI file to run. However, some servers may have the ".cgi" extension mapped to ActivePerl. This means that your binary CGI would not execute properly when executed, because it gets treated as a Perl script. In this case, you can work-around the problem by renaming the "search.cgi" file to "search.exe".

IIS 6.0 (Windows Server 2003)

Most of the steps for IIS 5.0 apply for IIS 6.0 as well. However, you may need to apply some additional server settings if your server has not previously been setup for executing CGI. This is due to additional security requirements being introduced in this version of Windows and IIS.

Namely, you will need to allow the Web Service Extension for CGI in the IIS Manager window.

This can be done from the IIS Manager window, by locating "Web Service Extensions", and changing the "All Unknown CGI Extensions" status to "Allow". However, this would allow any CGI applications to run on the server. If you wish to specifically allow ONLY the "search.cgi" application from Zoom to run, you should create a new Web Service Extension. Do this by right-clicking in the web service extensions list, and selecting "Add a New web service extension". Enter a name (eg. "Zoom Search Engine CGI"), and click on "Add". You will have to specify the path to the "search.cgi" file here, and click "OK". Once you have done this, change the status for the new extension to "Allow". For more information, refer to the above link and the Microsoft documentation for Configuring CGI Applications (IIS 6.0).

IIS 7.0 (Windows Vista, Windows Server 2008)

First, you must have the CGI role service enabled in IIS 7.0.

On Windows Server 2008, you do this by going to "Server Manager" -> "Roles" -> "Add Role Services".

Add Role Services for CGI

On Windows Vista, you can access a similar list of features from "Control Panel"->"Programs and Features"->"Turn Windows features on or off"->"Internet Information Services->"World Wide Web Services"->"Application Development Features".

Once you have CGI role enabled, you can start up the "Internet Information Services (IIS) Manager".

From here, you will first need to locate the folder that will be hosting your CGI and search files. This should be found under "<machine name>" -> "Sites" ->" Default Web Site" -> "<foldername>". Right click on the folder and select "Convert to Application". Click "OK" and accept the default settings.

Right click on the hosted folder name and select "Convert to Application"

Now select the "Handler Mappings" icon for this folder on the right hand side of the Manager window. You will see a list like below. Click on the "Add Module Mapping" option on the right hand side and enter the following:

Request path: *.cgi
Module: CgiModule
Leave the "Executable" field blank
Name: CGI

Click "OK" to finish adding the module mapping.

Now, the last step is to allow the CGI extension to run on the server. You do this on the "ISAPI and CGI Restrictions" page (I know, it doesn't make sense to us either). This can be found by clicking on the machine name in the tree view to the left-hand side of the window.

On the "ISAPI and CGI Restrictions" page , click on "Add..." on the right hand side of the window. Now specify the full path to the "search.cgi" file hosted in the folder we have configured before. Make sure to check the option to "Allow extension path to execute".

Add ISAPI or CGI Restriction

Concluding Notes

Your IIS server should now be configured to run the binary CGI search function. Index and upload your files to the folder (which you have set the permissions to following the instructions above), and load up the search page (search.cgi or search.exe) in your browser.

Update for GPO's: As if all this wasn't complex enough, in some rarer cases we have heard of IIS servers setup with GPO's (group policies) which alter the permissions of the "NETWORK SERVICE" account (by default, this is the account used by the web application). So because the permissions to this account are altered, it doesn't have enough permissions to run the cgi script, and you end up with a 403 - access denied error (403.19, error code 1314 to be exact). So your web application in IIS (website) uses an application pool, and that application pool runs under a specified user (default is NETWORK SERVICE). If this user doesn't have the proper permissions, it wont be able to run the cgi script. The rights it needs to have is "Adjust memory quotas for a process (SeIncreaseQuota)" and "Replace a process at token level (SeAssignPrimaryToken)". Here is a Microsoft KB article which provides several solutions. http://support.microsoft.com/kb/904056


Return to the Zoom Search Engine Support page