Apache-Tomcat服务的部署与安全调优。
下载并安装tomcat:https://tomcat.apache.org/download-80.cgi
wget http://mirrors.shu.edu.cn/apache/tomcat/tomcat-8/v8.5.37/bin/apache-tomcat-8.5.37.tar.gz tar xf apache-tomcat-8.5.37.tar.gz mv apache-tomcat-8.5.37 /usr/local/tomcat cd /usr/local/tomcat/bin/
启动关闭服务:
/usr/local/tomcat/bin/startup.sh //启动 /usr/local/tomcat/bin/shutdown.sh //停止 ss -nutlp | grep 8080 //通过查询默认端口知晓程序是否启动
web页面默认路径:
/usr/local/tomcat/webapps/
隐藏版本号:
注意!低版本的tomcat报头信息中会显示server版本号,而较高版本tomcat的报头信息中讲不会显示。
安装软件包:
yum -y install java-1.8.0-openjdk-devel
操作步骤如下:
jar -xf /usr/local/tomcat/lib/jar -xf catalina.jar vim /usr/local/tomcat/lib/org/apache/catalina/util/ServerInfo.properties 16 server.info=Apache Tomcat/8.5.37 17 server.number=8.5.37.0 vim /usr/local/tomcat/conf/server.xml 69 <Connector port="8080" protocol="HTTP/1.1" 70 connectionTimeout="20000" 71 redirectPort="8443" server="nginx"/> //添加server=''
降权启动:
操作如下:
useradd tomcat chown -R tomcat:tomcat /usr/local/tomcat/ su - -c /usr/local/tomcat/bin/startup.sh tomcat echo "su - -c /usr/local/tomcat/bin/startup.sh tomcat" >> /etc/rc.d/rc.local //设定开启启动 chmod +x /etc/rc.d/rc.local
发表评论