#start restart stop主程序:Catalina shutdown startup catalina -config xxcatalina start catalina runcatalina stop#tomcat 环境变量CATALINA_BASECATALINA_HOMECATALINA_OPTSCATALINA_TMPDIRJAVA_HOMEJAVA_HOMEJAVA_OPTSbin/startup.shbin/shutdown.sh#查看tomcat是否关闭ps auwwx | grep catalina.startup.Bootstrapkill##tomcat启动脚本#!/bin/sh#chkconfig: 2345 96 14JAVA_HOME=/usr/jdkCATALINA_HOME=/opt/tomcatexport JAVA_HOME CATALINA_HOMEexec $CATALINA_HOME/bin/catalina.sh $*##chown root.root tomcatchmod 755 tomcatnatiptables -t nat -I PREROUTING -p tcp --dport 80 -j REDIRECT --to-ports 8080iptabels -t nat -I OUTPUT -p tcp --dprot 80 -j REDIRECT --to-ports 8080 #dst###########config改成#只验证一次#使会话不超过两小时#使会话永久性存储#使用JDBC存储会话#TOMCAT启用对CGI的解析,把web.xml中的CGI的注释都删掉#配置主机deployOnStartup="false"##部署新站点#根网站##以WAR方式部署,需要设定 unpackWARs="true"##生成WAR文件jar cvf /opt/xxx.warab -k -n 10000 -c 149 http://sxxx:8080siege -b -r 671 -c 147 xxxjsp预编译ant -f xx.xml#apache传递给tomcat#安装mod_proxy_html模块LoadFile /usr/lib64/libxml2.so
LoadModule proxy_html_module modules/mod_proxy_hmtl.soProxyRequests offProxyPass /webapp-name/ http://tomcathost:8080/ProxyVia OnProxyHTMLURLMap http://tomcathost:8080 /webapp-nameRewriteEngine OnRewriteRule ^/webapp-name$ http://www.example.com/webapp-name/ [R,L] ProxyPassReverse /
SetOutputFilter proxy-html
ProxyHTMLURLMap images/ /webapp-name/images/
ProxyHTMLURLMap css/ /webapp-name/css/
RequestHeader unset Accept-Encoding########################################apache 与 tomcat 需要编译 mod_jk模块##apache下建workers.propertiesworker.list=tomcat1worker.tomcat1.type=ajp13worker.tomcat1.host=localhostworker.tomcat1.port=8009worker.tomcat1.connect_pool_size=150worker.tomcat1.conncet_pool_timeout=600worker.tomcat1.socket_keepalive=1#################################apache 与 tomcat ,,,apr模块#########开放tomcat防火墙iptables -A INPUT -p tcp --dport 8080 -d 10.0.0.2 -j ACCEPTiptables -A INPUT -p tcp --dport 8009 -d 10.0.0.2 -j ACCEPTiptables -A INPUT -p tcp --dport 8443 -d 10.0.0.2 -j ACCEPTXSS:HTTP会话劫持SQL注入HTML注入命令注入SSL##### cat -n /etc/postfix/main.cf | grep -v "#"##server.xmlserverserviceExecutor线程池ConnectorEngineHost appBase路径aa.com Loader 动态加载Manager 会话管理器Valve ???AccessLogValveororJDBCAccessLogValve#地址过滤404/errors/error.jsp##proxy_balancer负载均衡模块HTTPProxyRequests Off
BalancerMember http://node-a.myserver.com:8080 loadfactor=7 max=150 smax=145
BalancerMember http://node-b.myserver.com:8080 loadfactor=2 max=150 smax=145
BalancerMember http://node-c.myserver.com:8080 loadfactor=1 max=150 smax=145
ProxySet lbmethod=bytrafficProxyPass / balancer://mycluster stickysession=jsessionid
ProxyPassReverse balancer://myclusterAJP方式
BalancerMember ajp://127.0.0.1:8009 loadfactor=2 route=tomcat1
BalancerMember ajp://127.0.0.1:7009 loadfactor=2 route=tomcat2
ProxySet lbmethod=byrequests ProxyRequests Off ProxyPass /test balancer://mycluster/ stickysession=JSESSIONID nofailover=Off ProxyPassReverse /test balancer://mycluster/ lbmethod=byrequests 按照请求次数均衡(默认) lbmethod=bytraffic 按照流量均衡 lbmethod=bybusyness 按照繁忙程度均衡(总是分配给活跃请求数最少的服务器) #############################################################netstat -a -tcp#java vm配置-Xms 384M-Xmx 384M-Djava.security.debug=all-Duser.language=en-Dfile.encoding=UTF-8###nginx 重写模块一定要加proxy_set_header Accept-Encoding '';proxy_set_header Accept-Encoding ''; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_pass http://h5; sub_filter href="css href="h5/css; sub_filter src='js src='h5/js;sub_filter_types *;sub_filter_once off;###########################群集DNS轮询mod_proxy_balancer 负载均衡模块