In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
Hide apache version information
# # 33
Hide Apache information
[root@LAMP] # curl-I 127.0.0.1
HTTP/1.1 200 OK
Date: Thu, 24 Sep 2015 01:47:29 GMT
Server: Apache/2.2.27 (Unix) DAV/2 PHP/5.3.27
X-Powered-By: PHP/5.3.27
Content-Type: text/html
# # this shows that the version number is 2.2.27
[root@LAMP ~] #
1 enable httpd-default.conf in the master configuration
# vi / application/apache/conf/httpd.Conf
/ / find httpd-default.conf, delete the "#" before includes, and change it to the following
Include conf/extra/httpd-default.conf
Or use the sed command
Cd / application/apache/conf/
Grep "Include conf/extra/httpd-default.conf" httpd.conf
Sed-I 's$#Include conf/extra/httpd-default.conf$Include conf/extra/httpd-default.conf$g' httpd.conf
Grep "Include conf/extra/httpd-default.conf" httpd.conf
Modify httpd-default.conf
File: / application/apache/conf/extra/httpd-default.conf
find
ServerTokens Full
ServerSignature On
Change to
ServerTokens Prod
ServerSignature off
#
Or use the sed command
Cd / application/apache/conf/extra/
Egrep "ServerTokens Full | ServerSignature On" httpd-default.conf
Sed-I 's/ServerTokens Full/ServerTokens Prod/g' httpd-default.conf
Sed-I 's/ServerSignature On/ServerSignature off/g' httpd-default.conf
Egrep "ServerTokens | ServerSignature" httpd-default.conf
# sed process
[root@LAMP conf] # cd / application/apache/conf/extra/
[root@LAMP extra] # egrep "ServerTokens Full | ServerSignature On" httpd-default.conf
ServerTokens Full
ServerSignature On
[root@LAMP extra] # sed-I 's/ServerTokens Full/ServerTokens Prod/g' httpd-default.conf
[root@LAMP extra] # sed-I 's/ServerSignature On/ServerSignature off/g' httpd-default.conf
[root@LAMP extra] # egrep "ServerTokens | ServerSignature" httpd-default.conf
#
Restart apache to see if the version number has been changed
Curl-I 10.0.0.3
/ application/apache/bin/apachectl graceful
Curl-I 10.0.0.3
[root@LAMP extra] # / application/apache/bin/apachectl graceful
[root@LAMP extra] # curl-I 10.0.0.3
HTTP/1.1 200 OK
Date: Thu, 24 Sep 2015 01:54:18 GMT
Server: Apache
X-Powered-By: PHP/5.3.27
Content-Type: text/html
# # thus it can be seen that version 2.2.27 is missing. But the version of apache is still there.
[root@LAMP extra] #
The above method can only change the version number, but cannot change the version. If you need to change the version, Apache is installed by default. If it is compiled and installed, you can also modify the source code compilation method:
Modify the contents of the following two files:
/ home/lvnian/tools/httpd-2.2.27/include/ap_release.h
/ home/lvnian/tools/httpd-2.2.27/os/unix/os.h
Cp / home/lvnian/tools/httpd-2.2.27/include/ap_release.h / home/lvnian/tools/httpd-2.2.27/include/ap_release.h.ori
Cp / home/lvnian/tools/httpd-2.2.27/os/unix/os.h / home/lvnian/tools/httpd-2.2.27/os/unix/os.h.ori
The modifications are as follows:
#
40 # define AP_SERVER_BASEVENDOR "Apache Software Foundation"
41 # define AP_SERVER_BASEPROJECT "Apache HTTP Server"
42 # define AP_SERVER_BASEPRODUCT "Apache"
forty-three
44 # define AP_SERVER_MAJORVERSION_NUMBER 2
45 # define AP_SERVER_MINORVERSION_NUMBER 2
46 # define AP_SERVER_PATCHLEVEL_NUMBER 27
47 # define AP_SERVER_DEVBUILD_BOOLEAN 0
Modify it to the following
40 # define AP_SERVER_BASEVENDOR "lvnian IIS6 Software Foundation"
41 # define AP_SERVER_BASEPROJECT "lvnian IIS6 HTTP Server"
42 # define AP_SERVER_BASEPRODUCT "lvnian IIS6"
forty-three
44 # define AP_SERVER_MAJORVERSION_NUMBER 1
45 # define AP_SERVER_MINORVERSION_NUMBER 3
46 # define AP_SERVER_PATCHLEVEL_NUMBER 5
47 # define AP_SERVER_DEVBUILD_BOOLEAN 7
# # 3
Modify it with sed as follows:
Grep-n'"Apache' / home/lvnian/tools/httpd-2.2.27/include/ap_release.h
Cd / home/lvnian/tools/httpd-2.2.27/include/
Sed-I's / "Apache/" lvnian IIS6/g' ap_release.h
Sed-n'40 42p 'ap_release.h
Sed-n '44.47p' ap_release.h
Grep "AP_SERVER_MAJORVERSION_NUMBER 2" ap_release.h
Sed-I 's/AP_SERVER_MAJORVERSION_NUMBER 2/AP_SERVER_MAJORVERSION_NUMBER 1gamma g' ap_release.h
Sed-I 's/AP_SERVER_MINORVERSION_NUMBER 2/AP_SERVER_MINORVERSION_NUMBER 3gamma g' ap_release.h
Sed-I 's/AP_SERVER_PATCHLEVEL_NUMBER 27/AP_SERVER_PATCHLEVEL_NUMBER 5gamma g' ap_release.h
Sed-I 's/AP_SERVER_DEVBUILD_BOOLEAN 0/AP_SERVER_DEVBUILD_BOOLEAN 7gamma g' ap_release.h
Sed-n '44.47p' ap_release.h
Sed-n '3947p' ap_release.h
# sed command procedure
[root@LAMP ~] # grep-n'"Apache' / home/lvnian/tools/httpd-2.2.27/include/ap_release.h
38: * Example: "Apache/1.1.0 MrWidget/0.1-alpha"
40:#define AP_SERVER_BASEVENDOR "Apache Software Foundation"
41:#define AP_SERVER_BASEPROJECT "Apache HTTP Server"
42:#define AP_SERVER_BASEPRODUCT "Apache"
[root@LAMP ~] # cd / home/lvnian/tools/httpd-2.2.27/include/
[root@LAMP include] # sed-I's / "Apache/" lvnian IIS6/g' ap_release.h
[root@LAMP include] # sed-n '40J 42p' ap_release.h
# define AP_SERVER_BASEVENDOR "lvnian IIS6 Software Foundation"
# define AP_SERVER_BASEPROJECT "lvnian IIS6 HTTP Server"
# define AP_SERVER_BASEPRODUCT "lvnian IIS6"
[root@LAMP include] # sed-n'4J 47p 'ap_release.h
# define AP_SERVER_MAJORVERSION_NUMBER 2
# define AP_SERVER_MINORVERSION_NUMBER 2
# define AP_SERVER_PATCHLEVEL_NUMBER 27
# define AP_SERVER_DEVBUILD_BOOLEAN 0
[root@LAMP include] # grep "AP_SERVER_MAJORVERSION_NUMBER 2" ap_release.h
# define AP_SERVER_MAJORVERSION_NUMBER 2
[root@LAMP include] # sed-I 's/AP_SERVER_MAJORVERSION_NUMBER 2/AP_SERVER_MAJORVERSION_NUMBER 1 go to g' ap_release.h
[root@LAMP include] # sed-I 's/AP_SERVER_PATCHLEVEL_NUMBER 27/AP_SERVER_PATCHLEVEL_NUMBER 5max g' ap_release.h
[root@LAMP include] # sed-I 's/AP_SERVER_DEVBUILD_BOOLEAN 0/AP_SERVER_DEVBUILD_BOOLEAN 7DB g' ap_release.h
[root@LAMP include] # sed-n'4J 47p 'ap_release.h
# define AP_SERVER_MAJORVERSION_NUMBER 1
# define AP_SERVER_MINORVERSION_NUMBER 3
# define AP_SERVER_PATCHLEVEL_NUMBER 5
# define AP_SERVER_DEVBUILD_BOOLEAN 7
# 3
Modify the following contents of the / home/lvnian/tools/httpd-2.2.27/os/unix/os.h file to what you want to modify
35 # define PLATFORM "Unix"
If it is modified to
# define PLATFORM "win32"
The sed command is as follows
Cd / home/lvnian/tools/httpd-2.2.27/os/unix/
Sed-n'/ # define PLATFORM / p 'os.h
Sed-I 's/#define PLATFORM "Unix" / # define PLATFORM "LVNIAN WIN" / g' os.h
Sed-n'/ # define PLATFORM / p 'os.h
#
[root@LAMP unix] # sed-n'/ # define PLATFORM / p 'os.h
# define PLATFORM "Unix"
[root@LAMP unix] # sed-I 's/#define PLATFORM "Unix" / # define PLATFORM "LVNIAN WIN" / g' os.h
[root@LAMP unix] # sed-n'/ # define PLATFORM / p 'os.h
# define PLATFORM "LVNIAN WIN"
[root@LAMP unix] #
Remember that you don't need to remove # logout if you want any of the above.
Backup configuration fil
Recompile installation
Pkill httpd
Rm-rf / application/apache2.22.27
Cd / home/lvnian/tools
Cd httpd-2.2.27
. / configure\
-- prefix=/application/apache2.22.27\
-- enable-deflate\
-- enable-expires\
-- enable-headers\
-- enable-modules=most\
-- enable-so\
-- with-mpm=worker\
-- enable-rewrite
Make & & make install
# # solving the problem of slow startup of apache
Grep-I "# ServerName" / application/apache/conf/httpd.conf
Sed-I'/ # ServerName/aServerName 127.0.0.1 application/apache/conf/httpd.conf
Grep-I "ServerName" / application/apache/conf/httpd.conf
# # starting apache
Pkill httpd
Netstat-lnt
/ application/apache/bin/apachectl-t
/ application/apache/bin/apachectl start
# # testing
[root@LAMP httpd-2.2.27] # curl-I 10.0.0.3
HTTP/1.1 200 OK
Date: Thu, 24 Sep 2015 02:55:18 GMT
Server: lvnian IIS6/1.3.5-dev (LVNIAN WIN) DAV/2
Last-Modified: Sat, 20 Nov 2004 20:16:24 GMT
ETag: "20c8e-2c-3e9564c23b600"
Accept-Ranges: bytes
Content-Length: 44
Content-Type: text/html
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.