Apache安全配置

vi /etc/httpd/conf/httpd.conf #编辑文件
ServerTokens OS  在44行修改为:ServerTokens Prod (在出现错误页的时候不显示服务器操作系统的名称)
ServerSignature On  在536行修改为:ServerSignature Off (在错误页中不显示Apache的版本)
Options Indexes FollowSymLinks  在331行修改为:Options Includes ExecCGIFollowSymLinks(允许服务器执行CGI及SSI,禁止列出目录)
#AddHandlercgi-script .cgi 在796行修改为:AddHandlercgi-script .cgi .pl(允许扩展名为.pl的CGI脚本运行)
AllowOverride None  在338行修改为:AllowOverride All (允许.htaccess)
AddDefaultCharset UTF-8 在759行修改为:AddDefaultCharset GB2312 (添加GB2312为默认编码)
  Options Indexes MultiViewsFollowSymLinks 在554行修改为 Options MultiViewsFollowSymLinks(不在浏览器上显示树状目录结构)
DirectoryIndex index.html index.html.var 在402行修改为:DirectoryIndex index.html index.htm Default.html Default.htm

index.phpDefault.phpindex.html.var (设置默认首页文件,增加index.php)
KeepAlive Off 在76行修改为:KeepAlive On (允许程序性联机)
MaxKeepAliveRequests 100 在83行修改为:MaxKeepAliveRequests 1000 (增加同时连接数) 
:wq! #保存退出
/etc/init.d/httpd restart #重启
rm -f /etc/httpd/conf.d/welcome.conf /var/www/error/noindex.html #删除默认测试页

原文地址:https://www.cnblogs.com/evilxr/p/3929252.html