vi /etc/httpd/conf/httpd.conf ← 编辑Apache的配置文件 ServerTokens OS ← 找到这一行,将“OS”改为“Prod”(在出现错误页的时候不显示服务器操作系统的名称) ↓ ServerTokens Prod ← 变为此状态 ServerSignature On ← 找到这一行,将“On”改为“Off” ↓ ServerSignature Off ← 在错误页中不显示Apache的版本 ServerAdmin root@localhost ← 将管理员邮箱设置为自己常用的邮箱 ↓ ServerAdmin yourname@yourserver.com ← 根据实际情况修改默认设置 #ServerName new.host.name:80 ← 修改主机名 ↓ ServerName www.centospub.com:80 ← 根据实际情况修改,端口号保持默认的80 Options Indexes FollowSymLinks ← 找到这一行,删除“Indexes”,并添加“Includes”、“ExecCGI” ↓ Options Includes ExecCGI FollowSymLinks ← 允许服务器执行CGI及SSI #AddHandler cgi-script .cgi ← 找到这一行,去掉行首的“#”,并在行尾添加“.pl” ↓ AddHandler cgi-script .cgi .pl ← 允许扩展名为.pl的CGI脚本运行 AllowOverride None ← 找到这一行,将“None”改为“All” ↓ AllowOverride All ← 变为此状态,允许.htaccess LogFormat "%h %l %u %t /"%r/" %>s %b /"%{Referer}i/" /"%{User-Agent}i/"" combined ← 找到这一行 ↓ LogFormat "%h %l %u %t /"%!414r/" %>s %b /"%{Referer}i/" /"%{User-Agent}i/"" combined ← 改为此状态(添加“!414”到规则中,对于过长的日志不记录) AddDefaultCharset UTF-8 ← 找到这一行,在行首添加“#” ↓ #AddDefaultCharset UTF-8 ← 不使用UTF-8作为网页的默认编码 AddDefaultCharset GB2312 ← 并接着添加这一行(添加GB2312为默认编码) ← 找到这一个标签,并在标签中更改相应选项 ↓ Options MultiViews ← 变为此状态(不在浏览器上显示树状目录结构) rm -f /etc/httpd/conf.d/welcome.conf /var/www/error/noindex.html ← 删除测试页 |