Configuring the Web Server

In order to call a FoxWeb script, the Web server must first invoke the FoxWeb CGI or ISAPI modules (foxweb.exe and foxweb.dll respectively). These programs, are installed by the FoxWeb setup program in the directory that you specify during installation of the software.

Virtually all Web servers available today support CGI, while a few, including Microsoft Internet Information Server (IIS) and Personal Web Server (PWS) also support ISAPI.

By default most Web servers are installed with at least one directory already set up for CGI/ISAPI operation. These directories are usually set up, so that if the server receives a URL pointing to a program contained there, the server automatically runs that program and passes information about the request to it. When the program is finished executing, it passes information such as HTML content, back to the server for display by the browser. In the case of FoxWeb, the programs being called are either foxweb.exe or foxweb.dll. These two programs do not actually do much, other than transfer information back and forth between the Web server and the FoxWeb channels, which actually run FoxWeb scripts.

There are two ways to call the FoxWeb CGI/ISAPI module:

The preferred way to call FoxWeb scripts is to associate the FWX file extension with the CGI or ISAPI modules. When a properly configured server encounters this extension in the URL it will automatically call the CGI/ISAPI module. This technique is called script mapping and even though it may by somewhat harder to set up, it can make your URLs much shorter and simpler. It can also make it a lot simpler to mix static content, such as HTML pages and images, with your FoxWeb scripts. Here's a sample URL that utilizes script mapping:

    http://www.server.com/ContactMine2/contact.fwx

Another way is to directly refer to it in the URL. This method will work with any server and does not require much configuration. All you need to do is make sure that the CGI and ISAPI modules are installed in a directory that is configured for program execution. Following are examples of requesting the FoxWeb program contact.fwx, by directly calling the two modules:

    http://www.server.com/scripts/foxweb.exe/ContactMine2/contact.fwx

    - or -

    http://www.server.com/scripts/foxweb.dll/ContactMine2/contact.fwx

The rest of this page provides pointers on how to set up your Web server. Obviously we cannot be experts on all servers available today and we may be unable to help you with your particular server. Your Web server's documentation will probably be your best resource.

Microsoft IIS and PWS on Windows 2000/2003/XP/NT

IIS is by far the most popular web server software with FoxWeb users. The FoxWeb setup program attempts to configure IIS for proper FoxWeb operation, but there are a few rare cases where this step fails. Also, it is possible that you will want to configure your server in a different manner. For this reason, we are providing detailed instructions on how to configure IIS to work with FoxWeb.

Both IIS and PWS for Windows NT and 2000 can be configured with the Internet Services Manager. The two servers are almost identical, but PWS typically comes with the standard versions of the OS, while IIS comes with the server versions. Note that the default PWS installation does not install the Internet Services Manager. In order to install it you need to run the IIS setup program and select it. You will also need to select the MMC Console.

CGI/ISAPI Directory
View how to... If you want to call FoxWeb scripts by calling foxweb.dll, or foxweb.exe directly, you will need to configure a CGI/ISAPI directory, pointing to the location where you installed these files (or you can install FoxWeb, so that the files are copied to an existing CGI/ISAPI directory). By default both IIS and PWS create a virtual directory, called Scripts, which points to c:\inetpub\scripts and has Scripts and Executables access enabled. If you simply install foxweb.exe and foxweb.dll in this directory you will not need to do any additional configuration. To set up another CGI/ISAPI directory start the Internet Services Manager from the Start menu and expand the desired Web site. Select the directory you wish to configure, or create a virtual directory outside the Web tree, by right-clicking on the root directory. Bring up the property page of the selected directory by right-clicking on it and selecting "Properties". In the Directory page disable Read access and enable Script/Execute access. Save your changes.

Script Mapping
View how to... If you want to call FoxWeb scripts by including the .fwx extension you URLs, then you will need to configure script mapping for the .fwx extension. The FoxWeb setup program attempts to create a script map that associates fwx files with the ISAPI module, but in some cases it may fail. In order to manually configure your IIS and PWS for script mapping you will need to use the Internet Services Manager. Select your server (not a particular Web site, but the whole server right below Internet Information Services), right click on it, and bring up its property page. Under Master Properties select WWW Service and select Edit. In the Home Directory page select Configuration. In the App Mappings page look for the .fwx extension. If it does not exist click on the Add button, otherwise select it and click on the Edit button. Make sure that the Executable box points to foxweb.dll (or foxweb.exe) in your Scripts directory. Next you will need to select the HTTP methods that will be used in this mapping. In IIS 4 this box is titled Exclusions and requires that you list all the verbs you want to exclude. If you are running IIS 4 enter "PUT,DELETE". IIS 5 and above requires that you enter the verbs you want to allow in the Verbs box. In this case enter "GET,HEAD,POST". Enable the "Script Engine" option. You should only enable the "Check that File Exists" option if you have enabled the Use Web Server's Directory Mappings FoxWeb setting, and you want to use the Web server's native security mechanism. Note that in this case you will not be able to call PRG files with the .fwx script mapping -- you will need to create another script mapping for the .prg extension.

Enabling Script Access for Script Mapping
You will also need to enable Script access in all the directories where your Web server "thinks" your FoxWeb scripts reside. We say "thinks", because if you have not enabled the Use Web Server's Directory Mappings FoxWeb setting, FoxWeb scripts will not reside in the Web tree, but your server has no way of knowing this. For the purposes of the following example assume that your Web root is c:\inetpub\wwwroot and your FoxWeb Program Root is c:\Program Files\FoxWeb\Programs. If you call http://YourServer/ContactMine2/contact.fwx you will actually be calling the program c:\Program Files\FoxWeb\Programs\ContactMine2\contact.fwx, but to your Web server it looks like contact.fwx is located in the non-existent directory c:\inetpub\wwwroot\ContactMine2. The fact that the ContactMine2 directory does not exist under the Web root is not a problem unless you have enabled the "Check that File Exists" option, described in the previous paragraph; however, you do need to somehow let your Web server know that it is OK to execute scripts in this directory. One way to do this is to create an empty directory under wwwroot, called ContactMine2 and enable Script access in it. This method works fine, but it can become messy and time consuming if your scripts reside in many separate subdirectories. The simplest solution is to enable Script access in the home directory of your server, which will cover the whole directory structure under you FoxWeb Program Root. This option is enabled by default, but if you have manually changed your server's configuration you can re-enable it in the Properties window of your server's home directory.

Enabling FoxWeb to run on Windows 2003
IIS 6 on Windows 2003 has some additional security features that make it much more secure than previous incarnations. As a result, in addition to the configuration steps outlined above, you will need to add an entry for FoxWeb in the Web Service Extension list in order to run FoxWeb scripts. Once you create the FoxWeb entry, you will need to associate it with FoxWeb's CGI and ISAPI modules. The following image illustrates how to do this:

Configuring Web Service Extensions on IIS 6 and above

Microsoft PWS on Windows Me/98/95

Unlike IIS, this server cannot be configured with the Internet Services Manager. It provides a program called Personal Web Manager instead. Personal Web Manager can be used to configure a CGI/ISAPI directory, but you will need to manually edit the registry in order to configure script mapping on your server.

CGI/ISAPI Directory
To configure a CGI/ISAPI directory start the Personal Web Manager by clicking on its icon in the Start Menu (there may also be an equivalent icon on your desktop titled "Publish"). Select the Advanced icon to get to the Virtual Directory view (Advanced Options). If you have not changed your server's default configuration, there should already be a virtual directory called Scripts. Either add a virtual directory, or edit the existing Scripts directory. Make sure that this directory points to the location of foxweb.exe and foxweb.dll, and enable the Execute and Scripts checkboxes. Save you changes and exit the Personal Web Manager.

Script Mapping
The Personal Web Manager does not provide a user interface for the setup of script maps, so you will have to do this manually in the registry. After making your changes you will have to reboot the machine in order for your changes to take effect.

Start up the registry editor by running regedit.exe from the Windows Run box. Locate the key HKLM\System\CurrentControlSet\Services\W3SVC\Parameters\Script Map. Create a new String Value and name it ".fwx". Set the value to the full path of the CGI or ISAPI module, e.g. c:\inetpub\scripts\foxweb.dll. Exit the Registry Editor and reboot your system.

Enabling Script Access for Script Mapping
Just like you do with IIS, you need to enable script access in the directories where PWS "thinks" your scripts reside. Again, the simplest way to achieve this is to enable script access in your server's root directory. By default script access is already enabled for your root directory. If you have changed your server's configuration, you can revert it with the Personal Web Manager.

Apache

The Apache Web server is highly configurable and there are several ways to configure FoxWeb to work with it. Apache is configured by editing the file httpd.conf.

CGI Directory
Apache is installed with a default CGI directory with the alias "cgi-bin". Httpd.conf directives such as the following are responsible for this behavior:

        ScriptAlias /cgi-bin/ "C:/Apache/cgi-bin/"
        <Directory "C:/Apache/cgi-bin">
                AllowOverride None
                Options None
                Order allow,deny
                Allow from all
        </Directory>

For details on the meaning of each directive refer to the Apache documentation. If you wish you can create other CGI directories by using the above lines as templates.

Script Mapping

Script mapping can be achieved by adding the following two lines in the httpd.conf file:

        AddHandler foxweb-script .fwx
        Action foxweb-script /cgi-bin/FoxWeb.exe

Enabling Script Access for Script Mapping
Apache requires that the directories specified in a script mapped URL exist under the Web root. To do so you have two options:

  1. Duplicate your FoxWeb Program Root directory structure under your Web root. These directories can be left empty, or they may contain the static files associated with your FoxWeb applications.
  2. Store your FoxWeb scripts in directories under the Web root and enable the Use Web Server's Directory Mappings check box in the FoxWeb Control Center. For a discussion of this setting refer to the Locating and Addressing Scripts topic.

Other Web Servers

CGI Directory
Each server has different method of configuring a directory for CGI access. Most modern servers provide a graphical user interface for this purpose, but there are still some servers, which must be configured by manually editing configuration files. For information on how to set up a CGI directory on your particular server, please refer to your server's documentation.

Script Mapping
Most Web servers require that the script-mapped document being requested be present in the web tree before they pass the information to the CGI program. For this reason, it may be necessary that you enable the Use Web Server's Directory Mappings option. Note that enabling this option requires that you take extra steps to secure your server. For information on how to set up configure script mapping on your particular server, please refer to its documentation.


© Aegis Group