KeyFocus - KFWS Support

KF Web Server Frequently Asked Questions

How To Questions

  • How do I put my KF Web Server on the Internet?

  • How do I set up multiple web sites?

  • How do I set up multiple web sites so a user can access them all?

  • How does the server select the web site a user should see?

  • How can I configure the server for best performance?

  • How do I change the automatic directory index?

  • How do I change the format of the server's error messages?

  • How can I access the administration page from other machines?

  • How can I run KF Web Server as a systems service?

  • How do I set up an alias to map other directories into my web site?

  • How does HTTP compression help server performance?

  • How do I configure Analog logfile analyser to work with KF Web Server?

  • How do I password protect directories and sites?

  • How do I set up an alias directory?

  • How do I use the re-write rule feature?

  • How do I un-install KFWeb Server?

  • How do redirect a browser to another site or page?

  • Questions & Answers

    How To Questions

    How do I put my KF Web Server on the Internet?

    You may just want to user KF Web Server to develop web sites on your local machine or use it as an Intranet server on your LAN. KF Web Server works well for these purposes, but you may want to host your web sites on the Internet to allow everyone to see them.

    To do this you will need your own domain name so your users' browsers can find you using DNS. DNS is the means of converting a domain name to an IP address, which is used to make the connection.

    If your machine has a permanent IP address then all you need to do is register your domain name and get a web hosting or referral company to host your DNS record.

    Internet Service Providers charge a lot for permanent IP addresses and most people are assigned a temporary/dynamic IP address when they log onto their ISP. The standard DNS system takes several days to update and so makes it impossible to use with dynamic IP addresses.

    However there is a solution. There are many Dynamic DNS Providers who provide you with a domain name and update their DNS record every time you log on and are provided with your new IP address. This is much the cheapest way of getting your web server onto the internet. You will find a list of providers on the links page.

    How do I set up multiple web sites?

    Let us assume you want to set up 5 new unique web sites.

    1) First you will need to create 5 directories and copy your HTML and image files into each one.
    These can be anywhere on your hard disk. e.g. "C:\website1", "C:\website2" etc.
    The sample web site is installed by default in the directory "C:\Program Files\KeyFocus\KFWS\htdocs".
    You may want to keep all your web sites in this location but there is no requirement for you to do so.

    2) Next you will need to add 5 web sites in the "Web Sites" page on the Administration interface. For each web site set the "Document Root" field to "C:\website1", "C:\website2" etc.

    3) Next you will have to set the security for each of the directories.
    This is essential as KF Web Server is security conscious and prevents access to all directories unless you enable them to be seen.
    Go to the "Security -> Directories" page.
    If the directories are not present then you will need to add them.
    Set the Realm to "FreeForAll" for each directory to enable everyone to see them. If you want to limit access to these sites then you will need to add a new Security Realm.

    4) Next you will have to configure which site a user wants to visit. Please read the answer to the next question.

    How do I set up multiple web sites so a user can access them all?

    Setting up multiple web sites is easy on KF Web Server. The only tricky bit is determining which site a user wants to visit.

    There are three ways of doing this, on the "Web Sites -> Advanced" page:

    1) By Port

    The simplest way is to assign each web site its own port. If a port is not specified by a user then their browser always looks at the standard web port, number 80. However there is nothing to stop a browser looking at any port. So if you assign your second web site to port 3000, its URL on your local machine is This is great for your own development and testing but can make the URLs harder to remember.

    2) By Server Match Name

    The more sophisticated method is to assign a unique domain host name to a web site's "Server Match Name" field. When a user's browser makes a request it includes the host name it wants to query. KF Web Server uses this name to match the server name to the correct web site. This means you can have any number of web sites all listening on the default web port number 80.
    e.g. You could set up two sites; one with the Server Name "" and the other with "".

    The Server Match Name field is used to select which site the user is accessing by matching its value to the host supplied by the browser. The value can contains a wild card character, an asterisk, which will match part of a name.
    e.g. The value "*" will match both "" and "".
    If Server Match Name field is blank the value of the Server Name field will be used. If both fields are blank then the site will match any given host name.

    In order for this to work you need to configure the correct domain name to IP address mappings, so the user's browser can find your machine. To do this properly involves registering your domain names with an internet registrar, so that the world's DNS servers can find you. To do this you will need a permanent IP address and will have to pay for each domain name to be registered.

    Host File
    There is fortunately a free alternative, that is ideal for testing and for use on local area networks. Windows and UNIX both contain a system configuration file called "HOSTS". This is a text file that contains domain name to IP address mappings.

    The "HOSTS" file is located in different directories in different versions on windows. The best way to find it is to use the "Find In Files" utility, it will either be in your Windows directory or one of its sub-directories.

    Edit the file using Notepad and add the mappings that you need.

    For example the following mappings set up three domain names all pointing to your local machine. localhost

    Re-boot you machine after you have saved the file. Make sure you set each web site's "Server Name" field in KF Web Server with one of these domain names.

    If you type one of the above domain names into your web browser it should load the correct web site. This will only work on your local machine. In order to get other machines on you LAN to find these sites you will need to edit the "HOSTS" file on those machines. If you do this you will need to use the correct IP address for your server machine.

    3) By Bind Address

    The final method is to set the web sites "Bind Address" field. This matches a web site to the IP address of your machine the user is connecting to. To host multiple sites using this method your machine will have to have more than one IP address.

    These three methods all work together and enable you to make many different types of configurations.

    Once you have configured these settings you may find your server does not work the way you intended.
    Read the next question to learn how the server uses you configuration and if it does not work the read this question to help you resolve these issues, Users cannot access my different web sites.

    How does the server select the web site a user should see?

    For each user request KF Web Server needs to make a decision on which web site the request refers to.
    It does this by matching information provided in the user's request to the web sites you have configured.
    This is the most complex part of configuring your server.

    Each request contains the following information:

    1. The IP address on your machine that the user connected to. You may have several of these.
    2. The port on your machine that the user connected to.
    3. The Host that the user wants to query. This is the domain name the user has entered, e.g. "".
    KF Web Server cross references these three values with your configuration and finds web site the best matches them.
    The following are tried in order until a match is found.
    1. The port is the first thing that is checked. If the port on your web site does not match the request it will not be considered.
    2. The server will then try and match the request's Host setting with the "Server Name" of the web site.
    3. If the request Host setting is an IP address the server will try and match the "Bind Address" of the web site.
    4. The server will try and match the IP address the user connected to, to the "Bind Address" of the web site.
    If the "Server Name", or "Bind Address" address are set to blank then they are treated as a wild cards and will match any value in the request.
    If some web sites have blank settings and other specific settings then the web site with matching specific settings will be given priority.

    If the server cannot find a web site that matches the request then it will return a Forbidden error to the user.

    If your configuration does not work as you intended then read this question to help you resolve these issues, Users cannot access my different web sites.

    How can I configure the server for best performance?

    KF Web Server has been tested with very high volumes of traffic and has responded well. The way the software is written means there are no absolute limits to the number of clients or requests that can handled.

    However, in practice there are several factors that limit how much traffic your server can handle:

    1) Band-width
    The most important limit is the speed of your internet connection. If you only have a 56Kb dial up modem then your web site will appear sluggish to most users. If you have an ADSL line you will be able to handle more traffic, but don't forget that ADSL is a two speed service. It is twice as fast to download than to upload, which is what the server needs to do. Bear in mind that the speed of your connection is a theoretical maximum. Often ISPs deliver slower speeds in practice. Of course if you are lucky enough to have a T1 line you will get some serious performance.

    2) Processor speed
    KF Web Server needs to get a huge amount of traffic before it starts to reach your processors full potential. If your site makes heavy use of CGI and SQL databases, you may run into processor bottlenecks as these applications can use a lot of processor power.

    In practice the band-width constraints tend to kick in long before your processor's speed becomes a restriction.

    3) File types
    Most files on web servers tend to be very compact and do not take long to send. If you use your site to distribute large files such as executables, or music files then you will run into performance bottle necks sooner, as these files can be a thousand times bigger than an average home page.

    4) Operating system
    KF Web Server is designed to run on all versions of Windows from 98 upwards. At the systems level the NT derived versions such as 2000 and XP are much better than the 98 and ME versions and you will be able to get higher performance limits on those versions.

    5) Configuration
    KF Web Server has various settings that affect the performance of the server. No two web sites are exactly alike and so there is one perfect configuration for everybody. However, the default settings should not need to be altered if you have a basic web site with a small number of concurrent users.

    If you do start to run into performance bottle-necks then there are a number of things you can try.

    Turn on HTTP compression for your web site.

    An important setting you may want to change is the "Max Memory Cache" setting under the "Server -> Performance" menu. Ideally this should be the same size as the total file sizes of your pages and images.

    Under the "Server -> General" menu is the setting "Max Clients", which is set at 50 by default. You may need to increase it. This limits the number of connections the server can process at one time. Browsers open several concurrent connections to your server to speed up their performance, so you may exceed the 50 connection limit with 20 concurrent users. If the limit is exceeded then the user will receive a "Service Unavailable" error, until the number of connections drops below the "Max Clients" limit.

    Under "Web Sites -> Performance" menu there are two settings which boost users performance at the expense of your server.

    The "Connection Timeout" setting controls how long one user can hold open a connection before the server will close the connection and make the user open a new one. If some of your users are excluding other users by browsing your site for too long then reduce this limit.

    The "Connection Idle Timeout" settings controls how long the server will wait for request on an idle connection before closing the connection. If this is too short then a user's browser will be forced to open another connection each time the user goes to another page on your site, making their performance slower. If the setting is too long then users will hold an open connection that could be doing work for another user.

    The "Web Sites -> Security" menu contains settings that also effect performance. The reason these setting are considered security issues and not performance issues is that they prevent a user running a special kind denial of service (DOS) attack. A hacker could run a program that opens multiple connections to your server and then leaves them open. This could exceed the maximum connections settings for you server. If this occurs you can add their IP address to the excluded IP list. An effect of reducing these limits is increase the number of users that you can service at the expense of their own performance.

    The "Max Requests Per Resource Per IP" is there specifically to counter the special download utilities that are increasingly popular. These utilities speed up the downloading of large files from web sites by opening several connections at the same time to download different parts of the same file. This can result in one user having ten connections open, all of which are straining your server at the expense of other users. Many of these download utilities are badly written and result in multiple copies of the same part of a file being sent to a user. The "Max Requests Per Resource Per IP" puts a limit on this activity. However if you set this setting too low then you may restrict a normal browser as well as the down load utilities.

    How do I change the automatic directory index?

    An automatic directory index is generated if KF Web Server cannot find one of the standard index files such as index.html
    This is done using a script called makeindex.wkf, which can be found in the systemscripts sub-directory.

    Using a text editor you can change the text from English and even change the complete design by altering this script.
    The script contains a mixture of standard HTML and script commands written the KPL programming language.
    We will provide documentation for KPL in the future, but you should not find it hard to alter the HTML and the text written in quotes to change the script.

    How do I change the format of the server's error messages?

    When a user makes an invalid request, such as requesting a file that does not exist, the server returns an HTTP error and a HTML page describing that error.

    By default these HTML error pages are generated internally to a standard format. It is possible to define your own format by editing a special script to generate the error messages.

    To define your own error messages you first need to enable this feature.
    Go to the "Web Sites" menu and press the edit button next to the web site that should have custom error.
    Next select the "Enable Custom Errors" option, Press "OK" and "Save and Restart".

    The custom errors are generated by a script called "servererror.wkf", which can be found in the systemscripts sub-directory.

    Using a text editor you can change this script and alter the appearance of the error messages.
    The script contains a mixture of standard HTML and script commands written the KPL programming language.
    We do not provide any documentation for KPL yet, so if you would like to do this please email us for support.

    How can I access the administration page from other machines?

    Upon installation there are several security restrictions put in place on the Admin web-site to make it secure.
    The most important of these is the "Bind Address" of the Admin web site is set to "". This prevents any other machine from connecting to the admin web site, or even detecting its presence.

    Warning: Be extremely careful about making the following changes. If a cracker gains access to your Admin web site they could reconfigure your web site to give themselves access to your Windows directory, download your password files, crack them and then use other tools to gain access to the shares on your machine. This is why we turn off remote access to the Admin web site by default.

    The first thing you need to do is go to "Web Sites" menu and select the "Edit Web Site" button next to the Admin web site.

    Next, click on the "Advanced" sub-menu.

    Clear the fields "Server Name" and "Bind Address". This will allow any machine to connect to the Admin web site.

    Next, go to the Security -> Directories menu.

    Click on the "Security Restrictions" button, a little magnifying glass, next to the "{Admin}" directory.

    This will show you all the security checks on the Admin web site directory.
    You should see this site is restricted to the "admins" group, which is fine.

    You will also see that the "Allow IP Address" section contains "", which restricts access to the Admin site to the local machine.

    If you delete the "" row it will allow every machine on the internet to access you admin web site, provided the user knows your admin password of course.

    If you want to be more secure you can use the Add button to add all the IP Addresses of the machines from which you want to control the server from. This is the more secure option.

    You will also have to do the repeat the same steps with the Directory "{ServerRootPath}\help".

    Next, click on "Save and Restart" and then try to access your Admin web site from another machine.

    How can I run KF Web Server as a systems service?

    KF Web Server can be installed a systems service on Windows NT,2000 and XP only.

    A systems service is a special type of application that Windows runs in the background and is similar in concept to a UNIX daemon.

    There are several advantages to running KF Web Server as a systems service:

    1. The server can be configured to start automatically when the systems starts, even before you log on.
    2. The server becomes independent of the logged on user, so you can log off and another person can log on without affecting the server.
    3. The server can be configured to run as a different user with different security permissions.
    4. You can set up recovery actions to take place if the server fails. For example restarting the server or even restarting the computer.
    5. Start and stop the server from another machine without using a browser.
    KF Web Server can run as either a service or as a conventional application, which is the only option on Windows 98 and Windows ME.

    To install KF Web Server as a service right click on the KF Web Server Monitor in the system tray and select the "Install As System Service" menu option.
    You will need to be logged on with Administrator rights for this to work.

    If you install KF Web Server as a service, then you no longer need to run the KF Web Server Monitor for the server to operate.

    To configure the options for a systems service in Windows XP go to the Windows Control Panel, then select "Administrative Tools" and then select "Services".

    How do I set up an alias to map other directories into my web site?

    An alias is a means of making directories that are not sub-directories of your web site's document root appear as if they were.
    Aliases appear to be a sub-directory of your web site to the user and the actual location is hidden from them.
    A common use of this feature is to share the same images directory between different web sites.

    This explanation assumes you want to add the actual directory "W:\extrafiles" as the 'virtual sub-directory' called 'extra'.

    To set up an alias you first need to grant permission for the users to see the directory.

    Go to the "Security -> Directories" menu and press the "Add" button.

    Enter the full path of the directory containing you files. e.g. "W:\extrafiles".

    Select the Realm to control access. e.g. "FreeForAll".

    Press OK.

    Now to add the alias itself.

    Go to the "Web Sites" menu.

    Select the edit button of the site you want to have an alias.

    Go to the "Aliases" sub menu.

    Press "Add".

    In the Alias field add the name of the 'virtual sub-directory', e.g. "extra".

    In the Path field add the full path of the directory containing you files. e.g. "W:\extrafiles".

    Press OK and "Save and Restart".

    Test you alias by going to this address "".

    How does HTTP compression help server performance?

    The normal operation of a web server is to return an exact copy of the requested file to a user. This is potentially an inefficient use of bandwidth as a compressed version of the requested file could be much smaller. People often use tools such as WinZip to compress files they want users to download to speed up the process.

    The writers of the HTTP standard realised that if compression could be built into the standard then significant performance gains could be made, without the web master or the user doing any extra work. Several compression formats are build into the standard.
    KF Web Server implements the HTTP standard gzip compression encoding.

    Enabling HTTP Compression
    This feature must be enabled for each individual web site.
    Go to the "Web Sites" menu and select the "Edit" button of the web site.
    Select the "Performance" sub-menu and select the "Enable HTTP Compression" option.
    Press "OK" and "Save and Restart" buttons.

    What performance benefits can I expect?
    Only text based files are compressed. For example: HTML, XML and style sheet files.
    Image file formats already contain compression and some browsers can only cope with compression of text files.
    The gzip format used is based on the same algorithm as pkzip and gives a similar rate of compression. Typically you can expect HTML files to be compressed to 30% of their original size.
    The exact performance increase will depend on several factors:

    • The speed of your server's connection to the internet
    • The speed of your users' connection to the internet
    • The type of files on your web site
    So if you have a ADSL connection and you have a text intensive web site, such as a bulletin board, then you should notice a big boost to your performance.

    Is there a down side?

    Compressing data makes heavy use of you processor time. If your processor is too slow then you may find that enabling compression actually slows down your performance.

    Run your web server with both compression turned on and off and compare the results in you log file.
    Each request in you log contains the number of bytes sent to the client and the time taken to execute each request.
    Do not test your server from a browser on the same machine. You will gain nothing from the band-width reduction and get a performance hit as the server compresses the data and the browser un-compresses the data on the same processor.
    Also make sure you clear the browsers file cache at the start of each test.

    Is this compatible with older browsers?

    Possibly not. Compression is only used if the browser indicates to the server that it can accept gzip encoding. All modern browser can accept this format.

    Does compression work for CGI requests?
    Yes, providing the CGI application does not add its own content encoding.

    How it works in detail
    The user's browser attaches the following HTTP header to indicate what compression formats it will accept:

    Accept-Encoding: gzip, deflate

    If the header includes gzip and the request is for a text file then the output is compressed using the gzip algorithm.
    The server returns the following HTTP header to indicate that compression is being used:

    Content-Encoding: gzip

    How do I configure Analog logfile analyser to work with KF Web Server?

    Analog logfile analyser is a free application which reads web server log files and turns them into useful reports.

    To obtain Analog go to their web site and make sure you download the Windows version.

    Analog does not have an easy installation process, it does not have a GUI interface and requires you to edit a configuration file to make it work. The default Analog configuration does not recognise KF Web Server's log format so this needs to be configured as well.
    However, it is well worth the effort.

    Setting up Analog

    To install Analog you will need to unzip the Analog file into a blank directory.

    You will then have to edit the 'analog.cfg' file in a text editor such as notepad.

    Look for the following lines near the top of the file:

    # If you need a LOGFORMAT command (most people don't -- try it without first!),
    # it must go here, above the LOGFILE commands.
    LOGFILE logfile.log
    # LOGFILE C:\old\logs\access_log.*
    OUTFILE Report.html
    HOSTNAME "[my organisation]"

    Replace these lines with the following:

    LOGFORMAT (%Y-%m-%d%w%h:%n:%j%w%S%w%j%w%j%w%r%w%q%w%c%w%b%w%t%w%j%w%f)
    LOGFILE "C:\Program Files\KeyFocus\KFWS\logs\Home.log"
    OUTFILE Home.html
    HOSTNAME "KeyFocus"

    Change the LOGFILE setting to the path and name of your log file.
    Change the HOSTNAME to your server's name.
    This LOGFORMAT is set up for the default settings of KFWS logging screen. If you have changed the logging settings then you will need to change the LOGFORMAT line. Refer to the analog manual for details.

    Run Analog by double-clicking on the file analog.exe, or go into a DOS box, change to the analog directory and type analog.exe.

    View the file 'Home.html' in your web browser.

    How do I password protect directories and sites?

    In KF Web Server user permissions are set on a directory, allowing you maximum flexibility to configure what different users or groups of users have access to.

    To set up password access you first need to define a Realm.
    Each Realm contains a list of users' names and their passwords.
    Groups can also be defined which allow whole groups of users to be given the same permissions. To add and edit your Realm definitions goto the "Security -> Realms" menu.

    Security permissions are set on directories by going to the "Security -> Directories" menu.
    To change a directory's security settings first click on the "Edit" button next to the directory name.
    Then select the Realm that should be associated with this directory.

    Then press "Security Restrictions".
    You can then select which users or user groups are allowed to access the directory.

    How do I set up an alias directory?

    Go to the "Web Sites" menu.
    Select the "Edit Web Site" button next to the site you want to add the alias to.
    Select the "Aliases" sub-menu.
    Press the "Add" button and add the new alias details.

    The alias works for simple substitution, but for more complex and flexible requirements use the re-write rules feature

    How do I use the re-write rule feature?

    Go to the "Web Sites" menu.
    Select the "Edit Web Site" button next to the site you want to add the re-write rule to.
    Select the "URL-Rewrite-Rules" sub-menu.

    URL Rewrite Rules are a powerful feature that allows you to manipulate the URL received by the web server into a different form. Rewrite Rules can do everything an alias can do and more, but they are complex to set up.

    Rewrite Rules work by searching the URL for a specified pattern and then replacing it with the substitution text.
    The pattern is a perl compatible regular expression.

    For a detailed description of the syntax of regular expression have a look at the sites:

    Each Rewrite Rule is tested against the URL in order, allowing multiple substitutions to be made.

    There are many different reasons for using the Rewrite Rules feature and these are a few examples:

    Change a directory name:
    Pattern: ^/olddir/
    Substitution: /newdir/

    Change file extensions:

    Back References

    The substitution can include 'back-references', which refer to the sub-patterns in the pattern.
    This allows parts of the pattern to be treated as variables in the substitution.
    This allows very sophisticated substitutions to be made.

    A back-reference is a sub-pattern in the main pattern and is defined by using round brackets ()
    A back-reference can be used in the substitution in the form $N, where N is a number 1-9.

    This example allows a scripted page to be turned into a URL that can be recognized by a search engine.

    This will convert


    A rewrite rule only matches the resource part of the URL. It does not match the domain name or the query, that is anything after a ?. The substitution text can contain a query.


    It can be difficult to determine why a re-write rule is not working as expected. So there is a feature to provide de-bugging information.

    Turn on the Log Debug Info to log details of the actions performed by the Rewrite Rules into the system.log file.

    Example log:
    This example shows how a rule was activated to re-write a URL and is re-corded in system.log
    [2006/02/16 12:34:34.593 4] RewriteRule: ^/([0-9]+)?/ {INFO} </2006/02/ ==> /index.html/2006/02/>

    How do I un-install KFWeb Server?

    To un-install KFWeb Server and remove all traces of it do the following:

    1. Stop KFWS server.
      Right click on the KF Web Server Monitor in the system tray and select the "Stop Server".
    2. If you have installed KFWS as a system service (NT,2000,XP only) you need to un-install it.
      Right click on the KF Web Server Monitor in the system tray and select the "Un-install As System Service".
    3. Stop the KF Web Server Monitor.
      Right click on the KF Web Server Monitor in the system tray and select the "Exit".
    4. Go to the Control Panel and select "Add or Remove Programs".
      Select "KFWS", to run the un-install process.
    5. The deliberately does not remove any web pages that you create or your web log files. If you want to delete these go into Windows Explorer and delete the directory: C:\Program Files\KeyFocus\KFWS and everything in it.

    How do redirect a browser to another site or page?

    There is sometimes a need to automatically redirect a user to a different page or even a different web site.

    For example you may have another web site that you want your web site to automatically send a user to.
    e.g. redirects the user to

    The is done using a simple kfl script.
    Click on this link to download the example script and then modify it to your needs.