</IfModule>
# Change this to Listen on specific IP addresses as shown below to
# prevent Apache from glomming onto all bound IP addresses (0.0.0.0)
#
#Listen 12.34.56.78:80
Listen 80 //设置监听端口
# Dynamic Shared Object (DSO) Support
/*****/ //加载dso模块,就像是windows中的dll(动态链接库)
# ExtendedStatus controls whether Apache will generate "full" status
# information (ExtendedStatus On) or just basic information (ExtendedStatus
# Off) when the "server-status" handler is called. The default is Off.
ExtendedStatus On //用于检测apache的状态信息。
# User/Group: The name (or #number) of the user/group to run httpd as.
# . On SCO (ODT 3) use "User nouser" and "Group nogroup".
# . On HPUX you may not be able to use shared memory as nobody, and the
# suggested workaround is to create a user www and use that user.
# NOTE that some kernels refuse to setgid(Group) or semctl(IPC_SET)
# when the value of (unsigned)Group is above 60000;
# don't use Group #-1 on these systems!
#
User apache
Group apache //设置apache工作时使用的用户和组。
然后介绍主服务器配置(### Section 2: 'Main' server configuration)
# ServerAdmin: Your address, where problems with the server should be
# e-mailed. This address appears on some server-generated pages, such
# as error documents. e.g. admin@your-domain.com
#
ServerAdmin root@localhost // 当服务器发生问题的时候,apache会自动向这个邮箱发送相关邮件。
#
# If your host doesn't have a registered DNS name, enter its IP address here.
# You will have to access it by its address anyway, and this will make
# redirections work in a sensible way.
#
#ServerName www.example.com:80 //设定apache服务器用于标识自身的名字和端口号。一般情况下,apache可以通过DNS服务器获得自身的名字,但服务器没有正式的
DNS名字时,需要我们设定。如果这个设置出错,将导致服务器不能正常启动。
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "/var/www/html" //指定了主机中网页文件的根目录。
ServerSignature On // 当设置为On时,出错的时候服务器所产生的网页会显示Apache 的版本号、主机、连接端口等信息;如果设置为E-Mail,则会有“mailto:”的超链接
Alias /icons/ "/var/www/icons/"
<Directory "/var/www/icons">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order allow,deny //定义一个图标虚拟目录,并设置访问权限。
Allow from all
</Directory>
ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"
<Directory "/var/www/cgi-bin">
AllowOverride None
Options None
Order allow,deny //设置脚本的文件目录。
Allow from all
</Directory>
AddType text/html .shtml
AddOutputFilter INCLUDES .shtml //使用动态页面
#ErrorDocument 500 "The server made a boo boo."
#ErrorDocument 404 /missing.html
#ErrorDocument 404 "/cgi-bin/missing_handler.pl"
#ErrorDocument 402 http://www.example.com/subscription_info.html //设置各种错误类型的显示方式。