系统环境
[root@localhost ~]#
cat /etc/issue
CentOS release 5.10 (Final)
Kernel \r on an \m
@localhost ~]# java -version
java version "1.6.0_45"
Java(TM) SE Runtime Environment (build 1.6.0_45-b06)
Java HotSpot(TM) 64-Bit Server VM (build 20.45-b01, mixed mode)
[root@localhost ~]#
/opt/tomcat/bin/version.sh
Using CATALINA_BASE: /opt/tomcat
Using CATALINA_HOME: /opt/tomcat
Using CATALINA_TMPDIR: /opt/tomcat/temp
Using JRE_HOME: /opt/jre
Server version: Apache Tomcat/6.0.18
Server built: Jul 22 2008 02:00:36
Server number: 6.0.18.0
OS Name: Linux
OS Version: 2.6.18-371.8.1.el5
Architecture: amd64
JVM Version: 1.6.0_45-b06
JVM Vendor: Sun Microsystems Inc.
当404或者500页面错误时(错误示图如下),tomcat会返回相应版本号,为安全起见,可隐藏或者修改其版本号
操作如下
[root@localhost ~]#
cd $TOMCAT_HOME/lib
[root@localhost lib]#
mkdir -p org/apache/catalina/util
[root@localhost lib]#
cd org/apache/catalina/util
[root@localhost util]#
vim ServerInfo.properties
server.info=Apache Tomcat ---如果想修改成其它版本号,把这个地方的值改成其它值就行了
修改好之后再重启tomcat服务
[root@localhost util]#
/etc/init.d/tomcat stop
[root@localhost util]# /etc/init.d/tomcat start
效果如下
--转自