首页 > 代码库 > 测试及生产环境tomcat配置
测试及生产环境tomcat配置
环境:
系统为suse11 sp1
软件版本:
jdk1.7.0_80.zip
apr.tar.gz
apache-tomcat.tar.gz
tomcat部署目录为/apps,应用以ebay为例
注意:
实际配置要根据实际环境做改变,仅供参考
1、jdk环境配置
root用户
unzip jdk1.7.0_80.zip -d /usr/local
ln -s /usr/local/jdk1.7.0_80 /usr/local/jdk
vi /etc/profile
添加
export JAVA_HOME=/usr/local/jdk1.7.0_80
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
root用户和普通用户下执行
source /etc/profile
2、tomcat及apr配置
普通用户
tar -zxf apache-tomcat.tar.gz -C /apps
切换到root用户
tar -zxf apr.tar.gz -C /usr/local
普通用户
cd /app
mv apache-tomcat apache-tomcat-ebay
cd apache-tomcat-ebay/bin
vi catalina.sh
添加
[测试环境下]
ebay_env=‘uat‘
CATALINA_OPTS="$CATALINA_OPTS -Dspring.profiles.active=$ebay_env"
JAVA_OPTS="$JAVA_OPTS -Xms512m -Xmx512m -Xss512K -XX:PermSize=128m -XX:MaxPermSize=128m -XX:+HeapDumpOnOutOfMemoryError"
CATALINA_OPTS="$CATALINA_OPTS -Djava.library.path=/usr/local/apr/lib -Dspring.profiles.active=uat"
[生产环境下]
ebay_env=‘prod‘
CATALINA_OPTS="$CATALINA_OPTS -Dspring.profiles.active=$ebay_prod"
JAVA_OPTS="$JAVA_OPTS -Xms2048m -Xmx2048m -Xss512K -XX:PermSize=512m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError"
CATALINA_OPTS="$CATALINA_OPTS -Djava.library.path=/usr/local/apr/lib -Dspring.profiles.active=prod"
cd ../conf
数据源配置
vi server.xml
修改
Server port="8005" shutdown="SHUTDOWN"
Connector port="8080" protocol="org.apache.coyote.http11.Http11NioProtocol"
Connector port="8009" protocol="AJP/1.3" redirectPort="8443"
改为(端口根据需要定)
Server port="9005" shutdown="SHUTDOWN"
Connector port="9080" protocol="org.apache.coyote.http11..Http11AprProtocol
Connector port="9009" protocol="AJP/1.3" redirectPort="8443"
vi content.xml
在<Content </Content中添加下面的内容(测试环境为例)
<Resource name="jdbc/ebaydevdb" auth="Container" defaultAutoCommit="false" driverClassName="com.ibm.db2.jcc.DB2Driver" initialSize="15" maxActive="30" maxIdle="2" username="ebayuser" password="PASSWORD" type="javax.sql.DataSource" url="jdbc:db2://IP:PORT/EBAYDEVDB" />
vi web.xml(测试环境为例)
<resource-ref>
<res-ref-name>jdbc/ebaydevdb</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
本文出自 “xiaoxiaozhou” 博客,请务必保留此出处http://xiaoxiaozhou.blog.51cto.com/4681537/1953398
测试及生产环境tomcat配置