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"
[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"