Sambar Server Documentation

How To...


How do I execute CGI scripts from any directory ?
How do I restrict logging by IP address or request ?
How do I add a page counter ?
How do I add/remove/modify users ?
How do I password protect a file/directory ?
How do I increase the "Process Timeout" period of the server ?
How can I improve/tune the server performance ?
How can I get IRC to use the Sambar Server proxy ?
How can I use Cold Fusion with the Sambar Server ?
How can I remove extra Sambar versions from the Control Panel's Add/Remove list ?
How should I upgrade over a previous of the Sambar Server ?
How can I connect to AOL using the Sambar Server Proxy ?
How can I enable a camera (webcam) for use by the Sambar Server ?


How do I execute CGI scripts from any directory ?
[cgi-aliases] can be used to alias specific directories for CGI usage. This is the fastest and most secure method of adding another directory the execution of CGI scripts. This method is not appropriate if you have CGI scripts that are found throughout your document directories or need to be in the same directory as your documents.

To treat all files within your document directories that end in .pl as PERL CGI scripts, the CGI Extensions parameter of the config.ini file can be used to define *.pl as a valid CGI extension that can be found anywhere in the documents directory.

How do I restrict logging by IP address or request ?
Logging can be restricted using the Don't Log IPs and/or Don't Log Requests configuration entries in the config/config.ini file. A space separated list of IP addresses or requests can be provided for each configuration entry to not log HTTP requests matching the given IP or URL request. The wild-card character question-mark (?) can be used to match a single character and star (*) can be used to pattern match against multiple characters.

How do I add a page counter ?
To use the built-in page counter, you must create a file in the tmp directory of the Sambar Server installation. The file should initially contain the character 0 (you'll find the files tmp/index and tmp/samples corresponding with the two counters found in the Sambar Server samples. Each time the page with a counter is referenced, the counter in the file is incremented. To create a new counter, we'll call foobar and place it on a new page foobar.htm, we simple create a file called foobar in the tmp directory and then insert the following where we wish the counter to appear:

<IMG SRC="/session/pagecount?page=foobar">

The directory where the counter files are saved (tmp) can be modified by altering the Application Directory configuration parameter in the config.ini file.

How do I add/remove/modify users ?
All user management is performed from the User Management icon found in the System Administration main page. After clicking on the User Management icon, a list of users will be displayed. From these forms, you can add, delete or update user profiles. Changes to user accounts take effect immediately.

It is recommended that you modify the password of the "admin" user prior to putting the Sambar Server on a public network. Simply click on the "admin" account, and enter a new password into the Password field. Then update the admin account.

How do I password protect a file/directory ?
The [restrict] section of the config/security.ini file is used to restrict access to an individual file or directory of files. After setting up a user or group of users, you can restrict access with an entry such as:

[restrict]
/foobar = bob staff

The above entry restricts access to urls matching /foobar to the user bob or the users in the group staff.

How do I increase the "Process Timeout" period of the server ?
The "Process Timeout" is for network operations determined by the config/config.ini configuration entry:

[common]
Network Read Timeout = 300

The period (300) is in seconds.

How can display the current count of a page without increasing the page count ?
Stephen Goodson offers:

<!--#include file="C:/sambar416/tmp/counterfilename" -->

The Sambar Server has an automatic restart feature (typicaly used in conjunction with the RDBMS interface to clear connection pools.) Unfortunately, this feature is not the most stable aspect of the server. Restarting the server is a very tricky operation. Fortunately for NT users, Jeff Stone offers this alternative:

I use NT's built-in Scheduler service to stop and restart Sambar. For those who don't know how to do this, it's really simple. First, make sure the Schedule Service is set to Automatic in the Services Control Panel. Then, I created 2 batch files, one to start the server, one to stop it. They each contain 2 lines:

[startsambar.bat]
@echo off
net start "Sambar Server"

[stopsambar.bat]
@echo off
net stop "Sambar Server"

Now, I use the "at" command to submit 2 jobs to the scheduler.

c:\>at 7:00am /every:m,t,w,th,f,s,su stopsambar
c:\>at 7:02am /every:m,t,w,th,f,s,su startsambar

I wait 2 minutes to give my machine time to clear disk and memory caches. The /every: option tells the scheduler to do this on the days specified, which I do every day.

How can I improve/tune the server performance ?
The server provides an internal File cache mechanism which can be used to increase performance dramatically. The config.ini parameters affecting the file cache are:

  • File Cache Size is used to define the total file cache size in bytes.
  • Maximum Cached File is used to configure the largest file that should be cached.
  • Cache Flush Interval indicates how often the cache should be flushed (once it becomes full).

The System Administration interface provides cache statistics to assist with tuning the cache hit performance. For maximum performance, configure the File Cache Size large enough to serve all files out of memory file cache memory.

How can I get IRC to use the Sambar Server proxy ?
This configuration was recommended by J. vd Berg (config.ini settings):

Act As Bridge Proxy = true
Bridge Port = 6667
Bridge Server = irc.worldonline.nl

In addition, the MIRC32 settings are: IRC server: IP adress of your Sambar machine and port 6667 (should be the same as your bridge server). Now it should work. Now sambar sends all traffic send to port 6667 to the bridge server.

How can I use Cold Fusion with the Sambar Server ?
Christian Meis wrote that he uses Sambar Server 4.2 beta 4 and Cold Fusion 3.1.1 (workgroup) by installing Cold Fusion for ISAPI servers and adding the following entry to the mappings.ini file:

[isapi] *.cfm = c:\cfusion\bin\iscf.dll

How can I remove extra Sambar versions from the Control Panel's Add/Remove list ?
After multiple Sambar Server installs/upgrades, you may notice that the list of Sambar versions in the Control Panel's Add/Remove increases. Previous installs can be removed from the Add/Remove list without affecting the Sambar Server installation using the following tip from Jeff Adams:

For Windows 95/98 or Windows NT:

Run RegEdit
Navigate to: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall
There you'll uninstall Keys like:

Sambar Server 4.03 Production
Sambar Server 4.1 Production
Sambar Server 4.2 Beta 1
Sambar Server 4.2 Beta 2
Sambar Server 4.2 Beta 3
Sambar Server 4.2 Beta 4
If you've upgraded over the top of previous installations, the string value "UninstallString" for each of the Sambar entries should contain the same directory path. Example:

Sambar Server 4.03 Production
C:\WINNT\uninst.exe -f"C:\Program Files\Sambar\DeIsL1.isu"
Sambar Server 4.1 Production
C:\WINNT\uninst.exe -f"C:\Program Files\Sambar\DeIsL2.isu"
Sambar Server 4.2 Beta 1
C:\WINNT\uninst.exe -f"C:\Program Files\Sambar\DeIsL3.isu"
Sambar Server 4.2 Beta 2
C:\WINNT\uninst.exe -f"C:\Program Files\Sambar\DeIsL4.isu"
Sambar Server 4.2 Beta 3
C:\WINNT\uninst.exe -f"C:\Program Files\Sambar\DeIsL5.isu"
Sambar Server 4.2 Beta 4
C:\WINNT\uninst.exe -f"C:\Program Files\Sambar\DeIsL6.isu"

Given the above entries, all versions of Sambar were installed into the same directory, with Sambar 4.2B4 being the latest installation. This makes the uninstall entries for 4.03, 4.1, 4.2B1, 4.2B2, and 4.2B3 obsolete and the appropriate Keys can be deleted.

If you are uncomfortable with editing your registry manually, you could use the Microsoft's PowerToy TweakUI http://www.microsoft.com/windows95/downloads/contents/wutoys/w95pwrtoysset/default.asp.

How should I upgrade over a previous of the Sambar Server ?

  • Always install in a new directory.
  • Copy previous *.ini and messages files on top of your new installation. This way, new messages or config files will be available.
  • Make sure your Documents Directory is located outside your install directory(s). I generally put it in d:\docs
  • Shutdown your old server and startup your new one.
  • Rebuild your search indexes.
  • After it's run well for a week, delete your old installation directory.

How can I connect to AOL using the Sambar Server Proxy ?
To connect to America Online via TCP/IP through the Sambar Server proxy, you must be able to resolve the host americaonline.aol.com through port 5190. You can use the Bridge Proxy to map port 5190 to 198.81.21.1 (the IP address of americaonline.aol.com). Additionally, you must edit the hosts file in the Windows directory on the machines you wish to access AOL with and add the line:

192.168.0.1 americaonline.aol.com

In place of 192.168.0.1 you should set the IP Address of the machine on which the Sambar Server is running. Note: If only the hosts.sam file exists in your Windows directory, rename this file hosts; hosts.sam is a "sample" hosts file.

Lastly, AOL for Windows 2.5 and higher have TCP/IP as an access network selection. You need to indicate that TCP/IP is your connection type (in your AOL configuration).

How can I enable a camera (webcam) for use by the Sambar Server ?
The Sambar Server includes a WebCam module that can be used to take pictures. The source code for the WebCam module can be found in samples/source/webcam.c. This WebCam module uses Microsoft's Video for Windows to interact with the camera. Any camera that supports this standard should be compatible with the webcam_snapshot RPC.

To enable the webcam functionality, you must first install the WebCam module via the config/config.ini file.

INIT = samples.dll:webcam_init

Once initialized, the System Administrator can take a camera snapshot picture using the Sambar Server RPC:

<RCXwebcam_snapshot outfile=c:/sambar42/docs/picture.jpg>

The above RPC takes a picture and writes the output to the file specified in the outfile argument.

Automatic Pictures
The server can be programmed to automatically take pictures by adding an entry in the config/scheduler.ini instructing the server to process a Sambar Script page with the webcam_snapshot RPC embedded in it. For example, the following entry will take a webcam snapshot every 5 minutes:

[cron]
5 * * * * = /session/url2file?fname=/docs/index.htm&url=/takepic.stm

The above cron entry results in the URL takepic.stm being executed every 5 minutes; the output of the URL request is written to the index.htm file in the docs directory. The following is a sample takepic.stm file:

<HTML>
<BODY>
<H1>Welcome to Brian-Cam</H1>
<BR>
<BR>
<RCXwebcam_snapshot outfile=c:/sambar42/sysimage/brian.jpg>
<IMG SRC=/sysimage/brian.jpg>
<BR>
Last update: <RCEdatetime>
</BODY>
</HTML>

© 1998 Sambar Technologies. All rights reserved. Terms of Use.