#
# ServerName gives the name and port that the server uses to identify itself.
# This can often be determined automatically, but we recommend you specify
# it explicitly to prevent problems during startup.
#
# If this is not set to valid DNS name for your host, server-generated
# redirections will not work. See also the UseCanonicalName directive.
#
# 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 new.host.name:80 ← 修改主机名
↓
ServerName :80 ← 根据实际情况修改,端口号保持默认的80
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# #options
# for more information.
#
DirectoryIndex index.html index.html.var ←找到这一行,
DirectoryIndex index.html index.php ← 添加默认index.php文件
Options Indexes FollowSymLinks ← 找到这一行,删除“Indexes”,并添加“Includes”、“ExecCGI”
↓
Options Includes ExecCGI FollowSymLinks ← 允许服务器执行CGI及SSI
#
# AddHandler allows you to map certain file extensions to "handlers":
# actions unrelated to filetype. These can be either built into the server
# or added with the Action directive (see below)
#
# To use CGI scripts outside of ScriptAliased directories:
# (You will also need to add "ExecCGI" to the "Options" directive.)
#
#AddHandler cgi-script .cgi ← 找到这一行,去掉行首的“#”,并在行尾添加“.pl”
↓
AddHandler cgi-script .cgi .pl ← 允许扩展名为.pl的CGI脚本运行
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride None ← 找到这一行,将“None”改为“All”
↓
AllowOverride All ← 变为此状态,允许.htaccess
#
# Specify a default charset for all pages sent out. This is
# always a good idea and opens the door for future internationalisation
# of your web site, should you ever want it. Specifying it as
# a default does little harm; as the standard dictates that a page
# is in iso-8859-1 (latin1) unless specified otherwise i.e. you
# are merely stating the obvious. There are also some security
# reasons in browsers, related to Javascript and URL parsing
# which encourage you to always set a default char set.
#
AddDefaultCharset UTF-8 ← 找到这一行,在行首添加“#”
↓
#AddDefaultCharset UTF-8 ← 不使用UTF-8作为网页的默认编码
AddDefaultCharset GB2312 ← 并接着添加这一行(添加GB2312为默认编码)
<Directory "/var/www/icons"> ← 找到这一个标签,并在标签中更改相应选项
Options Indexes MultiViews ← 找到这一行,将“Indexes”删除
↓
Options MultiViews ← 变为此状态(不在浏览器上显示树状目录结构)
AllowOverride None
Order allow,deny
Allow from all
</Directory>
命令行下: chkconfig httpd on ← 设置HTTP服务自启动
chkconfig --list httpd
httpd 0:off 1:off 2:on 3:on 4:on 5:on 6:off ← 确认2--5为on的状态就OK
/etc/rc.d/init.d/httpd start ← 启动HTTP服务
Starting httpd: [ OK ] ← 启动成功会出现OK
在浏览器浏览 就可以看到测试页面出现,表示安装成功。