hide tomcat hide nginx version number

If the version number of tomcat is exposed, someone will exploit the vulnerabilities in this version to attack.
Hide tomcat version number
1.
Enter the lib directory of tomcat and find the catalina.jar file
2.
After unzip catalina.jar, there will be two more folders. Go to org/apache/catalina/util and edit the configuration file ServerInfo.properties

to
server.info=Apache Tomcat
server.number=0.0.0.0
server.built=Nov 7 2016 20:05:27 UTC


Compress the modified information back to jar Package
cd /tomcat/lib
jar uvf catalina.jar org/apache/catalina/util/ServerInfo.properties


2. Hide nginx version number:
Open Nginx main configuration file: nginx.conf, uncomment or add configuration statement.

http {
    # ... omit some configurations
  sendfile on;
  tcp_nopush on;
  keepalive_timeout 60;
  tcp_nodelay on;
    server_tokens off; #The default is commented out

  # ...omit some configuration
}




Test:
curl -I www.test.com
HTTP/1.1 200 OK
Server: nginx
Date: Tue, 13 Jul 2010 14:26:56 GMT
Content-Type: text/html; charset=UTF -8
Connection: keep-alive
Vary: Accept-Encoding

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326299610&siteId=291194637