apache学习安全总结

1、安全优化(此项为防止别人看到目录结构)
[root@python htdocs]# ls
wolf.html
[root@python htdocs]# mv wolf.html laolang.html


[root@python conf]# vi httpd.conf
下面这段去掉Indexes或者-Indexes
<Directory "/soft/apache/htdocs"> 
    Options Indexes FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>
网页打开能看到目录结构,所以把Indexes 去掉,此时报403错误(这是就需要修改为指定目录,虚拟主机里面有具体配置)
192.168.3.41 - - [03/Nov/2016:23:32:13 +0800] "GET / HTTP/1.1" 403 202
192.168.3.41 - - [03/Nov/2016:23:32:13 +0800] "GET / HTTP/1.1" 403 202
2、隐藏版本号
[root@python extra]# vi httpd-default.conf
把Full改为Prod


# ServerTokens
# This directive configures what you return as the Server HTTP response
# Header. The default is 'Full' which sends information about the OS-Type
# and compiled in modules.
# Set to one of:  Full | OS | Minor | Minimal | Major | Prod
# where Full conveys the most information, and Prod the least.
#
ServerTokens Prod


主配置文件里启用
# Various default settings
Include conf/extra/httpd-default.conf


[root@python conf]# curl -I http://bbs.wolf.com
HTTP/1.1 200 OK
Date: Sat, 12 Nov 2016 11:54:12 GMT
Server: Apache/2.2.31 (Unix)
Last-Modified: Sun, 06 Nov 2016 14:47:39 GMT
ETag: "23b6535-14-540a2fd214556"
Accept-Ranges: bytes
Content-Length: 20
Content-Type: text/html


[root@python conf]# ../bin/
ab            apxs          dbmmanage     htdbm         htpasswd      httxt2dbm     rotatelogs    
apachectl     checkgid      htcacheclean  htdigest      httpd         logresolve    
[root@python conf]# ../bin/apachectl -t
Syntax OK
[root@python conf]# ../bin/apachectl graceful
[root@python conf]# curl -I http://bbs.wolf.com
HTTP/1.1 200 OK
Date: Sat, 12 Nov 2016 11:54:35 GMT
Server: Apache
Last-Modified: Sun, 06 Nov 2016 14:47:39 GMT
ETag: "23b6535-14-540a2fd214556"
Accept-Ranges: bytes
Content-Length: 20
Content-Type: text/html


[root@python conf]# 
3、隐藏版本 (源码中改,然后才configure make make install)
[root@python include]# pwd
/soft/apache/include
[root@python include]# cat ap_release.h 


#define AP_SERVER_BASEVENDOR "Apache Software Foundation"
#define AP_SERVER_BASEPROJECT "Apache HTTP Server"
#define AP_SERVER_BASEPRODUCT "Apache"


#define AP_SERVER_MAJORVERSION_NUMBER 2
#define AP_SERVER_MINORVERSION_NUMBER 2
#define AP_SERVER_PATCHLEVEL_NUMBER   31
#define AP_SERVER_DEVBUILD_BOOLEAN    0


[root@python include]# cat os.h
#define PLATFORM "Unix"























评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值