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) 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 reference 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 on Recent Windows versions

In order for the FoxWeb setup program to be able to automatically configure IIS for FoxWeb, you must ensure that a number of required IIS features are installed properly, before running the FoxWeb setup program. If you happen to install FoxWeb before enabling these features, you will need to uninstall/reinstall FoxWeb, or run the setup program and select the Repair option.

In Windows 7 (and other recent desktop versions of Windows) the required features must be enabled in the "Turn Windows features on or off" dialog. To access this dialog click on the link with the same name in the left pane of the Programs and Features dialog, or simply open the Start menu and type "Turn Windows features on or off".

In Windows 2008 Server (and other recent Server versions of Windows) the required features are "Role Services" of the "Web Server (IIS)" role. They can be enabled in Server Manager (open the Start menu and type "Server Manager"). First install the "Web Server (IIS) role" and then enable the role services listed below.

The following features (or role services) are required:

The above role services are required to run FoxWeb with script-mapped URLs (recommended). If you are trying to install a legacy FoxWeb application with internal links directly referencing foxweb.dll or foxweb.exe, then you also need to enable ISAPI and/or CGI in the Handler Mappings section of the Internet Information Services configuration.

Configuring Permissions
The user account that FoxWeb is running under must have certain permissions for proper operation. If running FoxWeb as a service, this account is configured in the Windows "Services" setup. Locate the FoxWeb service and set a Log On account.

The FoxWeb user account must have Full Control rights in the hkey_local_machine\software\Aegis Group (hkey_local_machine\software\Wow6432Node\Aegis Group for 64-bit versions of Windows).

In addition, the account must have modify permissions (Modify, Read & Execute, List folder contents, Read, Write) in the following locations:

64-Bit Versions of Windows
In addition to the steps outlined above, 64-bit versions of Windows require additional configuration. The FoxWeb ISAPI dll is a 32-bit unmanaged module. By default IIS is not configured to run 32-bit modules. This can be changed in the Application Pool settings. To enable support for 32-bit modules:

  1. Start Administrative Tools\Internet Information Services (IIS) Manager.
  2. Identify the Application Pool associated with your FoxWeb site. You can see the application pool associated with a site by selecting it and clicking the Basic Settings link in the Actions pane.
  3. Locate the application pool in the Application Pools pane and click on the Advanced Settings link in the Actions pane.
  4. In the General section of the Advanced Settings dialog set Enable 32-Bit Applications to True.

Microsoft IIS on Windows 2000/2003/XP/NT

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.

CGI/ISAPI Directory
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 IIS creates 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
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 IIS 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

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