解压缩boa-0.94.13.tar.gz后,里面有个配置文件boa.conf,里面选项定义为:
# Boa v0.94 configuration file
# File format has not changed from 0.93
# File format has changed little from 0.92
# version changes are noted in the comments
#
# The Boa configuration file is parsed with a lex/yacc or flex/bison
# generated parser. If it reports an error, the line number will be
# provided; it should be easy to spot. The syntax of each of these
# rules is very simple, and they can occur in any order. Where possible
# these directives mimic those of NCSA httpd 1.3; I saw no reason to
# introduce gratuitous differences.
# $Id: boa.conf,v 1.25 2002/03/22 04:33:09 jnelson Exp $
# The "ServerRoot" is not in this configuration file. It can be compiled
# into the server (see defines.h) or specified on the command line with
# the -c option, for example:
#
# boa -c /usr/local/boa
# Port: The port Boa runs on. The default port for http servers is 80.
# If it is less than 1024, the server must be started as root.
Port 80
#监听的端口号,缺省都是80,一般无需修改
# Listen: the Internet address to bind(2) to. If you leave it out,
# it takes the behavior before 0.93.17.2, which is to bind to all
# addresses (INADDR_ANY). You only get one "Listen" directive,
# if you want service on multiple IP addresses, you have three choices:
# 1. Run boa without a "Listen" directive
# a. All addresses are treated the same; makes sense if the addresses
# are localhost, ppp, and eth0.
# b. Use the VirtualHost directive below to point requests to different
# files. Should be good for a very large number of addresses (web
# hosting clients).
# 2. Run one copy of boa per IP address, each has its own configuration
# with a "Listen" directive. No big deal up to a few tens of addresses.
# Nice separation between clients.
# The name you provide gets run through inet_aton(3), so you have to use dotted
# quad notation. This configuration is too important to trust some DNS.
#Listen 192.68.0.5
# bind和listen调用的IP地址,一般注释掉,表明绑定到INADDR_ANY,通配于服务器的所有IP地址
# User: The name or UID the server should run as.
# Group: The group name or GID the server should run as.
User nobody
Group nogroup
#作为哪个用户运行,即它拥有该用户的权限,一般都是nobody,需要/etc/passwd中有
#作为哪个用户组运行,即它拥有该用户组的权限,一般都是nogroup,需要在/etc/group文件中有nogroup组
# ServerAdmin: The email address where server problems should be sent.
# Note: this is not currently used, except as an environment variable
# for CGIs.
#ServerAdmin
#当服务器发生问题时发送报警的email地址,目前未用,注释掉
# ErrorLog: The location of the error log file. If this does not start
# with /, it is considered relative to the server root.
# Set to /dev/null if you don't want errors logged.
# If unset, defaults to /dev/stderr
ErrorLog /var/log/boa/error_log
#错误日志文件。如果没有以/开始,则表示从服务器的根路径开始。如果不需要错误日志,则用/dev/null。在下面设置时,注意一定要建立/var/log/boa目录
# Please NOTE: Sending the logs to a pipe ('|'), as shown below,
# is somewhat experimental and might fail under heavy load.
# "Usual libc implementations of printf will stall the whole
# process if the receiving end of a pipe stops reading."
#ErrorLog "|/usr/sbin/cronolog --symlink=/var/log/boa/error_log /var/log/boa/error-%Y%m%d.log"
# AccessLog: The location of the access log file. If this does not
# start with /, it is considered relative to the server root.
# Comment out or set to /dev/null (less effective) to disable
# Access logging.
AccessLog /var/log/boa/access_log
#访问日志文件。如果没有以/开始,则表示从服务器的根路径开始。如果不需要错误日志,则用#/dev/null或直接注释掉。在下面设置时,注意一定要建立/var/log/boa目录
# Please NOTE: Sending the logs to a pipe ('|'), as shown below,
# is somewhat experimental and might fail under heavy load.
# "Usual libc implementations of printf will stall the whole
# process if the receiving end of a pipe stops reading."
#AccessLog "|/usr/sbin/cronolog --symlink=/var/log/boa/access_log /var/log/boa/access-%Y%m%d.log"
# UseLocaltime: Logical switch. Uncomment to use localtime
# instead of UTC time
#UseLocaltime
#是否使用本地时间。如果没有注释掉,则使用本地时间。注释掉则使用UTC时间
# VerboseCGILogs: this is just a logical switch.
# It simply notes the start and stop times of cgis in the error log
# Comment out to disable.
#VerboseCGILogs
#是否记录CGI运行信息,如果没有注释掉,则记录,注释掉则不记录
# ServerName: the name of this server that should be sent back to
# clients if different than that returned by gethostname + gethostbyname
#ServerName
#服务器名字
# VirtualHost: a logical switch.
# Comment out to disable.
# Given DocumentRoot /var/www, requests on interface 'A' or IP 'IP-A'
# become /var/www/IP-A.
# Example: becomes /var/www/127.0.0.1
#
# Not used until version 0.93.17.2. This "feature" also breaks commonlog
# output rules, it prepends the interface number to each access_log line.
# You are expected to fix that problem with a postprocessing script.
#VirtualHost
#是否启动虚拟主机功能,即设备可以有多个网络接口,每个接口都可以拥有一个虚拟的Web服
务器。一般注释掉,即不需要启动
# DocumentRoot: The root directory of the HTML documents.
# Comment out to disable server non user files.
DocumentRoot /var/www
#非常重要,HTML文档的主目录。如果没有以/开始,则表示从服务器的根路径开始。
# UserDir: The name of the directory which is appended onto a user's home
# directory if a ~user request is recieved.
UserDir public_html
#如果收到一个用户请求的话,在用户主目录后再增加的目录名
# DirectoryIndex: Name of the file to use as a pre-written HTML
# directory index. Please MAKE AND USE THESE FILES. On the
# fly creation of directory indexes can be _slow_.
# Comment out to always use DirectoryMaker
DirectoryIndex index.html
#HTML目录索引的文件名,也是没有用户只指明访问目录时返回的文件名
# DirectoryMaker: Name of program used to create a directory listing.
# Comment out to disable directory listings. If both this and
# DirectoryIndex are commented out, accessing a directory will give
# an error (though accessing files in the directory are still ok).
DirectoryMaker /usr/lib/boa/boa_indexer
#当HTML目录没有索引文件时,用户只指明访问目录时,boa会调用该程序生成索引文件然后
#返回给用户,因为该过程比较慢最好不执行,可以注释掉或者给每个HTML目录加上#DirectoryIndex指明的文件
# DirectoryCache: If DirectoryIndex doesn't exist, and DirectoryMaker
# has been commented out, the the on-the-fly indexing of Boa can be used
# to generate indexes of directories. Be warned that the output is
# extremely minimal and can cause delays when slow disks are used.
# Note: The DirectoryCache must be writable by the same user/group that
# Boa runs as.
# DirectoryCache /var/spool/boa/dircache
#如果DirectoryIndex不存在,并且DirectoryMaker被注释,那么就用Boa自带的索引
#生成程序来生成目录的索引文件并输出到下面目录,该目录必须是Boa能读写
# KeepAliveMax: Number of KeepAlive requests to allow per connection
# Comment out, or set to 0 to disable keepalive processing
KeepAliveMax 1000
#一个连接所允许的HTTP持续作用请求最大数目,注释或设为0都将关闭HTTP持续作用
# KeepAliveTimeout: seconds to wait before keepalive connection times out
KeepAliveTimeout 10
#HTTP持续作用中服务器在两次请求之间等待的时间数,以秒为单位,超时将关闭连接
# MimeTypes: This is the file that is used to generate mime type pairs
# and Content-Type fields for boa.
# Set to /dev/null if you do not want to load a mime types file.
# Do *not* comment out (better use AddType!)
MimeTypes /etc/mime.types
#指明mime.types文件位置。如果没有以/开始,则表示从服务器的根路径开始。可以注释掉
#避免使用mime.types文件,此时需要用AddType在本文件里指明
# DefaultType: MIME type used if the file extension is unknown, or there
# is no file extension.
DefaultType text/plain
#文件扩展名没有或未知的话,使用的缺省MIME类型
# CGIPath: The value of the $PATH environment variable given to CGI progs.
CGIPath /bin:/usr/bin:/usr/local/bin
#提供CGI程序的PATH环境变量值
# SinglePostLimit: The maximum allowable number of bytes in
# a single POST. Default is normally 1MB.
# AddType: adds types without editing mime.types
# Example: AddType type extension [extension ...]
# Uncomment the next line if you want .cgi files to execute from anywhere
#AddType application/x-httpd-cgi cgi
#将文件扩展名和MIME类型关联起来,和mime.types文件作用一样。如果用mime.types
#文件,则注释掉,如果不使用mime.types文件,则必须使用
# Redirect, Alias, and ScriptAlias all have the same semantics -- they
# match the beginning of a request and take appropriate action. Use
# Redirect for other servers, Alias for the same server, and ScriptAlias
# to enable directories for script execution.
# Redirect allows you to tell clients about documents which used to exist in
# your server's namespace, but do not anymore. This allows you to tell the
# clients where to look for the relocated document.
# Example: Redirect /bar
#指明文档重定向路径
# Aliases: Aliases one path to another.
# Example: Alias /path1/bar /path2/foo
Alias /doc /usr/doc
#为路径加上别名
# ScriptAlias: Maps a virtual path to a directory for serving scripts
# Example: ScriptAlias /htbin/ /www/htbin/
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
#非常重要,指明CGI脚本的虚拟路径对应的实际路径。一般所有的CGI脚本都要放在实际路径
#里,用户访问执行时输入站点+虚拟路径+CGI脚本名
用户可以根据自己需要,对boa.conf进行修改,但必须要保证其他的辅助文件和设置必须和boa.conf里的配置相符,不然Boa就不能正常工作。 在上面的例子中,我们还需要创建日志文件所在目录/var/log/boa,创建HTML文档的主目录/var/www,将mime.types文件拷贝 到/etc目录,创建CGI脚本所在目录/var/www/cgi-bin/。mime.types文件用来指明不同文件扩展名对应的MIME类型,一般 可以直接从Linux主机上拷贝一个,大部分也都是在主机的/etc目录下。