Tomcat 配置集锦

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

Tomcat配置集锦引用通告地址:=79Tomcat服务器server.xml的关键参数配置说明:以下文字均以tomcat5.0.30为例进行。1,配置tomcat服务器访问端口,只需配置Connector的port端口即可。Tomcat默认为8080,现修改port参数值为80。2,配置tomcat支持URL中文参数,只需添加Connector的URIEncoding参数即可,默认情况下该参数未被配置。要支持URL参数支持中文,加上URIEncoding=”GBK”就行了(见1中附代码最后一行)。3,配置新的webApp:找到host尾标记,插入新的context即可。如:(1)若要支持数据库(以SQLServer为例),则为:(2)factoryorg.apache.commons.dbcp.BasicDataSourceFactorymTomcat服务器server.xml的关键参数配置说明:以下文字均以tomcat5.0.30为例进行。1,配置tomcat服务器访问端口,只需配置Connector的port端口即可。Tomcat默认为8080,现修改port参数值为80。!--Defineanon-SSLCoyoteHTTP/1.1Connectoronport8080--Connectorport=80maxThreads=150minSpareThreads=25maxSpareThreads=75enableLookups=falseredirectPort=8443acceptCount=100debug=0connectionTimeout=20000disableUploadTimeout=trueURIEncoding=GBK/2,配置tomcat支持URL中文参数,只需添加Connector的URIEncoding参数即可,默认情况下该参数未被配置。要支持URL参数支持中文,加上URIEncoding=GBK就行了(见1中附代码最后一行)。3,配置新的webApp:找到host尾标记/Host,插入新的context即可。如:(1)Contextpath=docBase=ROOTdebug=0/若要支持数据库(以SQLServer为例),则为:(2)Contextpath=/xkbdocBase=F:\XKB6\webAppdebug=5reloadable=truecrossContext=trueLoggerclassName=org.apache.catalina.logger.FileLoggerprefix=localhost_DBTest_log.suffix=.txttimestamp=true/Resourcename=jdbc/SqlServerDBauth=Containertype=javax.sql.DataSource/ResourceParamsname=jdbc/SqlServerDBparameternamefactory/namevalueorg.apache.commons.dbcp.BasicDataSourceFactory/value/parameter!--MaximumnumberofdBconnectionsinpool.Makesureyouconfigureyourmysqldmax_connectionslargeenoughtohandleallofyourdbconnections.Setto0fornolimit.--parameternamemaxActive/namevalue50/value/parameter!--MaximumnumberofidledBconnectionstoretaininpool.Setto0fornolimit.--parameternamemaxIdle/namevalue20/value/parameter!--MaximumtimetowaitforadBconnectiontobecomeavailableinms,inthisexample0.5seconds.AnExceptionisthrownifthistimeoutisexceeded.Setto-1towaitindefinitely.--parameternamemaxWait/namevalue500/value/parameter!--msSQLdBusernameandpasswordfordBconnections--parameternameusername/namevaluesa/value/parameterparameternamepassword/namevaluewangnewton/value/parameter!--ClassnameforSQLServer2000JDBCdriver--parameternamedriverClassName/namevaluecom.microsoft.jdbc.sqlserver.SQLServerDriver/value/parameter!--TheJDBCconnectionurlforconnectingtoyourMSSQLServerdB.TheautoReconnect=trueargumenttotheurlmakessurethatthemm.SqlServerJDBCDriverwillautomaticallyreconnectifmysqldclosedtheconnection.mysqldbydefaultclosesidleconnectionsafter8hours.--parameternameurl/namevaluejdbc:microsoft:sqlserver://localhost:1433;databaseName=XKBCourse/value!--mustuse¬use&--/parameter/ResourceParams/Contexttomcat5.5.x配置记录。1.下载:://://://://把jakarta-tomcat-5.5.x.zip和jakarta-tomcat-5.5.x-compat.zip和jakarta-tomcat-5.5.x-admin.zip(Tomcat默认是没有内置admin模块了Tomcat'sadministrationwebapplicationisnolongerinstalledbydefault.Downloadandinstalltheadminpackagetouseit.)都解压到同一个目录下面。比如:D:\jakarta-tomcat-5.5.x\(如果使用jdk1.4,才需要compat.zip用jdk1.5就可以免了这个。)2.修改jakarta-tomcat-5.5.x\conf\tomcat-users.xml.添加管理员账号lizongbo,密码为lizongbopass.新xml如下:?xmlversion='1.0'encoding='utf-8'?tomcat-usersrolerolename=tomcat/rolerolename=role1/rolerolename=manager/rolerolename=admin/userusername=tomcatpassword=tomcatroles=tomcat/userusername=role1password=tomcatroles=role1/userusername=bothpassword=tomcatroles=tomcat,role1/userusername=lizongbopassword=lizongbopassroles=admin,manager//tomcat-users3.修改jakarta-tomcat-5.5.x\conf\server.xml来解决编码问题。(给Connector添加URIEncoding参数,参考)(可以设置成GB18030)Connectorport=8080maxThreads=150minSpareThreads=25maxSpareThreads=75enableLookups=falseredirectPort=8443acceptCount=200connectionTimeout=20000disableUploadTimeout=trueURIEncoding=GBKcompression=oncompressionMinSize=2048noCompressionUserAgents=gozilla,traviatacompressableMimeType=text/html,text/xml/Connectorport=8009enableLookups=falseredirectPort=8443protocol=AJP/1.3URIEncoding=GBK/4.启用支持gzip压缩.(=1&i=81169)添加下列属性compression=oncompressionMinSize=2048noCompressionUserAgents=gozilla,traviatacompressableMimeType=text/html,text/xml5.设置虚拟主机。在jakarta-tomcat-5.5.x\下建立文件夹vhost\。然后修改jakarta-tomcat-5.5.x\conf\server.xmlEnginedefaultHost=localhostname=CatalinaHostappBase=vhost/==webappsname=localhost/HostRealmclassName=org.apache.catalina.realm.UserDatabaseRealm//Engine6.添加数据库驱动,更新mail.jar和actiovation.jar复制mysql-connector-java-3.0.16-ga-bin.jar,pg74.215.jdbc3.jar到j

1 / 38
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功