|
|
The MacHTTP.config file is a plain text file (Macintosh file type
'TEXT') containing a number of lines with keyword commands on them.
These commands instruct MacHTTP on how it should operate.
Keyword commands may be entered in any order in the MacHTTP.config file,
with a few considerations. The VERSION should be the first command.
Security entries (ALLOW, DENY) are evaluated in the order specified in the file.
Note: all keywords are converted to upper case by MacHTTP, so they can be in any case.
(IE. vErSiOn). Any line that doesn't start with a keyword will be
ignored by MacHTTP. By convention, you should begin any non-keyword lines with
the # character unless the line is blank.
VERSION <number>Suggested setting: Use the setting from the config file that comes with MacHTTPThe
VERSION keyword informs MacHTTP what version the configuration file is set for.
If the version is newer that MacHTTP's version number, some commands may not be supported.
This should be the first keyword command in the MacHTTP.config file.
<TYPE> <suffix> <mac file type> <mac creator> <MIME type>Suggested setting: See the list of filetype mappingsThere is a maximum of 20 suffix definitions (in addition to the default mapping).
MacHTTP follows the following pattern for identifying file type mappings.
Note that this might be more accurately listed as:
TEXT .HQX * * application/mac-binhex40
If there are any file type mappings defined before it in the config file which have the
'TEXT *' mapping, since those will be used first.
The <TYPE> defines how MacHTTP accesses the file and how it is transmitted to the client.
The options include:
ACGI - Asynchronous CGI application. Same as CGI applications,
except that MacHTTP won't wait for the response, but rather will allow other
applications (and even ACGI applications that have already been called) to be
called at the same time.
APPL - Application type (obsolete after MacHTTP version 1.3).
BINARY - A binary (non-text) file such as a word processor document
or graphics file.
CGI - Common Gateway Interface application. Commonly compiled AppleScripts
or other AppleEvent supporting programs.
SCRIPT - Plain text (non-compiled) AppleScript that is run by MacHTTP.
TEXT - Plain text file (almost always with Macintosh file type 'TEXT').
Note that most word-processor files are not plain text unless specifically saved or
exported in text or 'ASCII text' format.
ACGI type because it puts the least demand on MacHTTP - allowing your server
to get back to work right away. All other script/application types
(CGI, SCRIPT, APPL) prevent the server from processing any other
script/application requests until they are done. (Is this true for CGI???)
SCRIPTs create a big demand on MacHTTP's processing and should really only be
used in cases where a script has to be generated on the fly (which could, with some
effort, actually be accommodated in an ACGI or CGI) or where
you don't have access to an AppleScript compiler - in which case may I introduce you to
MacPERL?
So, the preference for application or script types (in order from most preferred to least):
ACGI
CGI
SCRIPT (avoid if at all possible)
APPL (absolutely do not use unless you are using an existing
application with a version of MacHTTP less than or equal to 1.3)
*' is used for a parameter, MacHTTP will ignore it.
Following are some examples of how MacHTTP will treat '*'s in mappings.
Any file with mac type 'TEXT' and creator 'ToyS':
SCRIPT * TEXT ToyS text/html
Any file ending in '.XBM':
BINARY .XBM * * image/x-xbm
Any file ending in '.HQX', or any file with mac type 'TEXT':
TEXT .HQX TEXT * application/mac-binhex40
Any file ending in '.WORD', or any file with mac type 'WDBN' and creator 'MSWD':
BINARY .WORD WDBN MSWD application/msword
If the client supports HTTP/1.0, MacHTTP will create the MIME header based on the transfer and MIME types specified. This will not be done for scripts which must create and return HTTP/1.0 headers.
DEFAULT <default transfer type> <default MIME type>Suggested setting: DEFAULT TEXT text/html
The default file transfer type and mime type for files which are not specified in
the list of suffix file type mappings.
The <default transfer type> is any one of the transfer types (IE. BINARY).
The <default MIME type> is the MIME type to be used.
For example, to have files default as plain text sent as HTML:
INDEX <filename>Suggested setting: INDEX default.html
The default home page for directories (equivelant to "index.html" with unix 'httpd').
For example, if you define:
INDEX homepage.cgi
then MacHTTP will treat the URL:
http://your.server.at/folder/
as equivelant to:
http://your.server.at/folder/homepage.cgi
ERROR <filepath>Suggested setting: NOACCESS Error.html
When a client tries to access a file that doesn't exist, this file will be returned.
Should be a '.html' text file.
The filepath is Macintosh format:
[<Diskname>][:<foldername>][:<foldername>]:<filename>
If the diskname (root) portion is not specified, the file will be located relative to the
MacHTTP root directory.
LOG <filepath>Suggested setting: LOG MacHTTP.log
The text file where the log of MacHTTP transactions will be kept.
The filepath is Macintosh format:
[<Diskname>][:<foldername>][:<foldername>]:<filename>
If the diskname (root) portion is not specified, the file will be located relative to the
MacHTTP root directory.
NOACCESS <filepath>Suggested setting: NOACCESS NoAccess.html
When a site that is denied access to the MacHTTP server tries to access a file
(a security violation), this file will be returned.
The filepath is Macintosh format:
[<Diskname>][:<foldername>][:<foldername>]:<filename>
If the diskname (root) portion is not specified, the file will be located relative to the
MacHTTP root directory.
NO_DNSSuggested setting: Don't use unless you have the problems detailed belowIf this keyword is in your configuration file, MacHTTP won't access a Domain Name Server to get the host names of the sites that access your system. This won't hinder the performance of MacHTTP - in fact it can noticibly speed things up if your domain name server is slow or you are on a slow network connection (IE. slip or ppp). This will however result in logging only the IP addresses of sites that connect to MacHTTP (IE. "
123.456.78.90" instead of
"name.of.site").
TIMEOUT <number>Suggested setting: TIMEOUT 60
The timeout for connections from clients that are inactive. If a connection is inactive
for the specified time MacHTTP will close it.
Normally, timeout should be set to 60 seconds.
MAXUSERS <number between 3 and 1000>Suggested setting: MAXUSERS 15
The maximum number users permitted to be connected at the same time.
Note that the larger this value is, the more memory you will have to allocate to MacHTTP.
Memory is allocated by selecting the application in the Finder, when MacHTTP is not running,
selecting Get Info... from the File menu, and then changing the setting
in the info window that opens.
You should monitor MacHTTP's actual memory usage over time, as you increase maxusers. You will also want to monitor the maximum number of simultaneous connections your server receives in order to know when you should increase maxusers.
MAXLISTENS <number between 3 and 50>Suggested setting: MAXLISTENS 10
The number of TCP "listens" that are to be made available by MacHTTP. This is where MacHTTP
listens for client requests to establish a connection. As soon as a client connects to the
server using one of the available listens, MacHTTP puts up a new one.
With the development of simultaneous lookups by http client software (specifically NetScape) it is recommended that a minimum of 10 listens be put up. You shouldn't need much more than this, unless you find your site becomes particularly popular. If you receive "Unable to connect" reports (unless you know your server was down) you should probably increase the maxlistens.
If this keyword is not specified in the config file, MacHTTP will default to 5.
PORT <number 80 or greater than 1024 & less than 32768>Suggested setting: PORT 80
MacHTTP only supports listening to one TCP 'port'. You can, however, run multiple
copies of MacHTTP with each listening to a different port.
The standard port for http servers is 80. All numbers including and below
1024 are reserved for "well known services." So, your choices for a port
are 80 and any number larger than 1024 (but less than
32768). The most common port choices for http servers (other than
80) are 8080 and 8001.
If you specified a number less than or equal to 1024, other than 80, you would likely conflict with other services, and possibly cause errors for MacHTTP.
Interface OptionsHIDEWINDOWSuggested setting: up to the userThe status window will 'hide' (not be shown) when the application is not in front of other applications. This is useful for systems which are not dedicated to being a server.
Note that this is an obsolete keyword as of version 2.0 (but not the beta versions leading up to 2.0).
PIG_DELAY <number between 0 and 120>Suggested setting: PIG_DELAY 30
Note that this setting is irrelevant if you are running a thread-manager supporting version of MacHTTP or WebSTAR and you have Apple's Thread Manager installed (built in to System 7.5 and later).
The type of multi-tasking performed by the Macintosh operating system is known as 'cooperative.' What this means is that when an application (also called a process) is given access to the processor, no other processes will be able to do anything until that application, in the spirit of 'cooperation', tells the operating system that some other process can take over the processor. Typically, this switching between processes is quite fast (less than a second between switches).
The PIG_DELAY keyword allows you to set how long MacHTTP will 'hog' the
processor until letting some other process get some time. If your server is used for
work besides being an http server you will want to keep this number relatively low -
not higher than about 30. If your system is infrequently or not at all
used for other purposes, you might want to set this to a higher value to allow MacHTTP
to go a little faster (not especially significant unless the server is extremely busy).
DUMP_BUF_SIZE <number between 256 and 10240>Suggested setting: DUMP_BUF_SIZE 4096
MacHTTP sends files (and results from scripts and applications) in chunks. By splitting up the transfer of files in this manner, the server doesn't get tied up sending just one thing - it can spread it's time between many transfers, and also give some time for other applications to work. If you're working on your computer while it is serving documents, this 'chunking' of transfers allows the programs you're using to function without 'freezing' whenever MacHTTP sends data out.
The other side of the coin are the clients connecting to your server. If the network connection is a fairly fast one (IE. T1 or T3)
|
|
|
|
|