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 password protect a file/directory ?
How do I increase the "Process Timeout" period of the server ?
How do I setup a new System Administrator ?
How can I improve/tune the server performance ?
How can I get IRC to use the Sambar Server proxy ?
How can I use ColdFusion 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 can I use iASP from HalcyonSoft with the Sambar Server ?
How can I enhance the performance of pages by seting the Expires header and/or compression ?
How can I password protect a directory ?
How can I modify the international message strings ?
How can I change the server to use CPAN/ActiveState Perl ?
How do I have the server announce Privacy Preferences (P3P) ?


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 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 (for HTTP access only). 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.

Note: The htaccess file directives can be used to restrict access for FTP clients; the [restrict] settings in the security.ini only apply to HTTP clients.

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 do I setup a new System Administrator ?

  1. Create the new administrator account from the Users pages under System Administration Security.
  2. Modify the Server Configuration form and change the System Administrator to the new user created.
  3. Shutdown and then restart the Sambar Server
  4. Delete the old administrator account from the Users forms.

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. See the Performance documentation for additional options.

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 ColdFusion with the Sambar Server ?
Christian Meis wrote that he uses Sambar Server 4.2 beta 4 and ColdFusion 3.1.1 (workgroup) by installing ColdFusion for ISAPI servers and adding the following entry to the mappings.ini file:

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

ColdFusion Express 4.5 is also known to work with Sambar Server 5.0 by using the above mapping. In order to use the ColdFusion administrator pages, you must follow these steps (according to a Macromedia ColdFusion forum -- many thanks to Mike Watkins for these):

Install the Sambar Server first and then install ColdFusion (ColdFusion must be manually installed in the Sambar Server docs directory; this should install the CFIDE under docs.) Then add the *.cfm ISAPI mapping instruction above. Next, remove the password authorization from ColdFusion by changing the registry key: HKEY_LOCAL_MACHINE\SOFTWARE\Allaire\ColdFusion\CurrentVersion\Server Change the UseAdminPassword entry to 0. Finally, go into the Sambar Server system administator pages and add the security restriction restricting access to the /CFIDE directory to the admin user. Restart the Sambar Server and you should be off have full use of ColdFusion.

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 files on top of your new installation. This way, new system messages (/messages), /config/globals.c and any new configuration files will be available. The Sambar Server is always compatible with previous configuration files, so even a 4.0 configuration file can be used in the latest server. When the server starts, the configuration files are auto-upgraded to the latest release. Going to the System Administration panel and viewing the configuration and saving it to disk will make those changes visible on disk. Note: Once upgraded, you are not typically able to use these configuration file on a down-level release.
  • 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 or two, delete your old installation directory.

Pro server licensees can use the auto-upgrader integrated into the server and available from the Upgrade link on the System Administrator console.

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. Note! The webcam feature was last tested with Windows 98 and NT 4.0; later releases of Microsoft's operating system may not be compatible.

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/schedule.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>

How can I use iASP from HalcyonSoft with the Sambar Server ?
iASP from HalcyonSoft can be used with the Sambar Server by adding the following entry to the mappings.ini file:

[isapi]
/iasp = c:\iasp
[isapi]
*.asp = c:\iasp\bin\sambar\iasp.dll

How can I enhance the performance of pages by seting the Expires header and/or compression ?
The following example illustrates some htaccess that can be useful in enhancing the performance of the server (courtesy of Fozner):

# Enable expirations
ExpiresActive on
# Expire GIFs after one month (so the browser will cache them)
ExpiresByType image/gif A2592000
# Expire HTML files one day after they were last modified
ExpiresByType text/html M86400
# Compress all text/html content
Compress text/html

How can I password protect a directory ?
There are several ways to accomplish this including:

  • If you have created users from the System Administration forms, the easiest way to enforce passwords is by creating a .htaccess file in the directory you want to protect and place the following on the first line of the .htaccess file: require valid-user
    Alternatively you can specify the user's permitted access with: require user username1 username2...
  • You may create a separate file with usernames/passwords to restrict directory access to using the htaccess AuthUserFile and follow the steps above.
  • You can use the security.ini security to restrict access by hostname, IP address, or user as well.

How can I modify the international message strings ?
At startup the server caches the message strings for the /sysadmin console (incomplete as of this writing) and then automatically changes the string output based on the client browser and/or cookie indicating the language to use. All strings are loaded from /messages/locale/messages.ini (i.e. /messages/en_us/messages.ini). In addition, if a corresponding file named custom.ini is found to exist, these strings are also loaded. Users wishing to override or supplement the I18N strings should place their additions in the custom.ini language file following the same format as messages.ini.

How can I change the server to use CPAN/ActiveState Perl ?
The perl distribution that comes with the Sambar Server is quite basic. Users planning on doing significant perl CGI development are encouraged to install a more complete perl distribution and modules from CPAN or ActiveState. Once installed, the Sambar Server can be modified to use the new perl distribution by modifying or creating a new CGI Association for your new perl distribution,

*.pl = /perl/perl.exe

How do I have the server announce Privacy Preferences (P3P) ?
The Sambar Server provides webmasters with the ability to add and customize HTTP headers. Directives can be added to the server configuration file config/htaccess. Generically, to create a P3P header, add the following line:

Header set P3P CP="NON DSP COR CURa TIA"
Directory, Location, and Files are sectional directives used within the htaccess file allow webmasters to determine whether directives apply to the site in general or to specific files or directories. This allows webmasters to create several P3P Compact Policies. For example, the Location directive applies to specified URLs. The Location directive will be used in two different examples. The first example demonstrates how to indicate a single policy reference file for the entire web site.

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