本文共 2238 字,大约阅读时间需要 7 分钟。
yum –y install java-1.8.0-openjdk java-1.8.0-openjdk-headlessjava -version
tar –xf apache-tomcat-8.0.30.tar.gzmv apache-tomcat-8.0.30 /usr/local/tomcatmv /dev/random /dev/random.bakln –s /dev/urandom /dev/random/usr/local/tomcat/bin/startup.shss –anptu | grep java
à8005/8009/8080三个端口必须正常运行
vim /etc/rc.local /usr/local/tomcat/bin/startup.sh
vim /usr/local/tomcat/webapps/ROOT/test.jspNow time is : <%=new java.util.Date()%>
firefox 192.168.1.1:8080/test.jsp
# vim /usr/local/tomcat/conf/server.xml# mkdir -p /usr/local/tomcat/{a,b}/ROOT# echo "AAA" > /usr/local/tomcat/a/ROOT/index.html# echo "BBB" > /usr/local/tomcat/b/ROOT/index.html
vim /usr/local/tomcat/conf/server.xml
# firefox http://www.a.com:8080/test
vim /usr/local/tomcat/conf/server.xml
vim /usr/local/nginx/conf/nginx.conf http { upstream tomcat { server 192.168.1.1:8080; server 192.168.1.2:8080; } server { listen 80; server_name localhost; location / { proxy_pass http://tomcat; } } }
# yum –y install java-1.8.0-openjdk-devel# cd /usr/local/tomcat/lib/# jar –xf catalina.jar# vim org/apache/catalina/util/ServerInfo.properties server.info=Ktz/1.0.0 server.number=1.0.0 server.built=Dec 1 2015 22:30:46 UTC# vim /usr/local/tomcat/conf/server.xml
默认tomcat使用系统高级管理员账户root启动服务,启动服务尽量使用普通用户,防止别人通过tomcat服务供给服务器。
# useradd –s /sbin/nologin tomcat# chown –R tomcat:tomcat /usr/local/tomcat/# su –c /usr/local/tomcat/bin/startup.sh tomcat# chmod +x /etc/rc.local# vim /etc/rc.local# su –c /usr/local/tomcat/bin/startup.sh tomcat
转载地址:http://kvcqj.baihongyu.com/