Tomcat production environment configuration and tomcat production environment

Source: Internet
Author: User

Tomcat production environment configuration and tomcat production environment

In the window, at the top of catalina. bat:
Set JAVA_OPTS =-XX: PermSize = 64 M-XX: MaxPermSize = 128 m-Xms512m-Xmx1024m;-Duser. timezone = GMT + 08;
It must be added at the top of catalina. bat.

 

In linux, add the following at the beginning of catalina. sh:

JAVA_OPTS = "-XX: PermSize = 64 M-XX: MaxPermSize = 128 m-Xms512m-Xmx1024m-Duser. timezone = Asia/Shanghai"


<?xml version='1.0' encoding='utf-8'?><!--  Licensed to the Apache Software Foundation (ASF) under one or more  contributor license agreements.  See the NOTICE file distributed with  this work for additional information regarding copyright ownership.  The ASF licenses this file to You under the Apache License, Version 2.0  (the "License"); you may not use this file except in compliance with  the License.  You may obtain a copy of the License at      http://www.apache.org/licenses/LICENSE-2.0  Unless required by applicable law or agreed to in writing, software  distributed under the License is distributed on an "AS IS" BASIS,  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the License for the specific language governing permissions and  limitations under the License.--><!-- Note:  A "Server" is not itself a "Container", so you may not     define subcomponents such as "Valves" at this level.     Documentation at /docs/config/server.html --><Server port="8005" shutdown="SHUTDOWN">  <!-- Security listener. Documentation at /docs/config/listeners.html  <Listener className="org.apache.catalina.security.SecurityListener" />  -->  <!--APR library loader. Documentation at /docs/apr.html -->  <Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />  <!--Initialize Jasper prior to webapps are loaded. Documentation at /docs/jasper-howto.html -->  <Listener className="org.apache.catalina.core.JasperListener" />  <!-- Prevent memory leaks due to use of particular java/javax APIs-->  <Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />  <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />  <Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" />  <!-- Global JNDI resources       Documentation at /docs/jndi-resources-howto.html  -->  <GlobalNamingResources>    <!-- Editable user database that can also be used by         UserDatabaseRealm to authenticate users    -->    <Resource name="UserDatabase" auth="Container"              type="org.apache.catalina.UserDatabase"              description="User database that can be updated and saved"              factory="org.apache.catalina.users.MemoryUserDatabaseFactory"              pathname="conf/tomcat-users.xml" />  </GlobalNamingResources>  <!-- A "Service" is a collection of one or more "Connectors" that share       a single "Container" Note:  A "Service" is not itself a "Container",       so you may not define subcomponents such as "Valves" at this level.       Documentation at /docs/config/service.html   -->  <Service name="Catalina">    <!--The connectors can use a shared executor, you can define one or more named thread pools-->   <Executor name="tomcatThreadPool" namePrefix="catalina-exec-"        maxThreads="500" minSpareThreads="20" maxIdleTime="60000" />    <!-- A "Connector" represents an endpoint by which requests are received         and responses are returned. Documentation at :         Java HTTP Connector: /docs/config/http.html (blocking & non-blocking)         Java AJP  Connector: /docs/config/ajp.html         APR (HTTP/AJP) Connector: /docs/apr.html         Define a non-SSL HTTP/1.1 Connector on port 8080    -->   <Connector executor="tomcatThreadPool"               port="80" protocol="HTTP/1.1"               connectionTimeout="60000"               keepAliveTimeout="15000"               maxKeepAliveRequests="100"               redirectPort="443"               maxHttpHeaderSize="8192" URIEncoding="UTF-8" enableLookups="false" acceptCount="100" disableUploadTimeout="true"/>    <!-- A "Connector" using the shared thread pool-->    <!--    <Connector executor="tomcatThreadPool"               port="8080" protocol="HTTP/1.1"               connectionTimeout="20000"               redirectPort="8443" />    -->    <!-- Define a SSL HTTP/1.1 Connector on port 8443         This connector uses the BIO implementation that requires the JSSE         style configuration. When using the APR/native implementation, the         OpenSSL style configuration is required as described in the APR/native         documentation -->    <!--    <Connector port="8443" protocol="org.apache.coyote.http11.Http11Protocol"               maxThreads="150" SSLEnabled="true" scheme="https" secure="true"               clientAuth="false" sslProtocol="TLS" />    -->    <!-- Define an AJP 1.3 Connector on port 8009 -->    <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />    <!-- An Engine represents the entry point (within Catalina) that processes         every request.  The Engine implementation for Tomcat stand alone         analyzes the HTTP headers included with the request, and passes them         on to the appropriate Host (virtual host).         Documentation at /docs/config/engine.html -->    <!-- You should set jvmRoute to support load-balancing via AJP ie :    <Engine name="Catalina" defaultHost="localhost" jvmRoute="jvm1">    -->    <Engine name="Catalina" defaultHost="localhost">      <!--For clustering, please take a look at documentation at:          /docs/cluster-howto.html  (simple how to)          /docs/config/cluster.html (reference documentation) -->      <!--      <Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/>      -->      <!-- Use the LockOutRealm to prevent attempts to guess user passwords           via a brute-force attack -->      <Realm className="org.apache.catalina.realm.LockOutRealm">        <!-- This Realm uses the UserDatabase configured in the global JNDI             resources under the key "UserDatabase".  Any edits             that are performed against this UserDatabase are immediately             available for use by the Realm.  -->        <Realm className="org.apache.catalina.realm.UserDatabaseRealm"               resourceName="UserDatabase"/>      </Realm>      <Host name="localhost"  appBase="webapps"            unpackWARs="true" autoDeploy="true">        <!-- SingleSignOn valve, share authentication between web applications             Documentation at: /docs/config/valve.html -->        <!--        <Valve className="org.apache.catalina.authenticator.SingleSignOn" />        -->        <!-- Access log processes all example.             Documentation at: /docs/config/valve.html             Note: The pattern used is equivalent to using pattern="common" -->        <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"               prefix="localhost_access_log." suffix=".txt"               pattern="%h %l %u %t "%r" %s %b" />      </Host>    </Engine>  </Service></Server>



How to configure tomcat environment variables?

Add the following to the environment variable:
Tomcat_home
E:/java/Tomcat6.0 // Replace the drive letter with your own tomcat.

Others: You have to change it to your own one.
Classpath

.; E: \ Java \ jdk1.6.0 _ 11 \ lib \ dt. jar; E: \ Java \ jdk1.6.0 _ 11 \ lib \ tools. jar

JAVA_HOME
E: \ Java \ jdk1.6.0 _ 11

Path

; E: \ Java \ jdk1.6.0 _ 11 \ bin;

Tomcat_home
E: \ Java \ Apache Tomcat 6.0.18

E: \ Java \ Tomcat 6.0

E: \ oracle \ product \ 10.1.0 \ db_1 \ bin; % SystemRoot % \ system32; % SystemRoot % \ System32 \ Wbem; D: \ Program Files \ MySQL Server 5.0 \ bin; E: \ Java \ jdk1.6.0 _ 11 \ bin

How to configure the environment for tomcat, beginner

System Environment:
1. Operating System: Windows 2000
2. Database: Oracle 8i R2 (8.1.6) for NT Enterprise Edition
3. installation path: C: \ ORACLE

In this example, the software is used:
1、jdk-1.4-win.exe [19.5 MB]
Java.sun.com/
2、jakarta-tomcat.zip [2.26 MB]
Jakarta.apache.org/builds/tomcat/release/v4.06

Installation Method:
The method in () is the directory on my machine, which is easy to use to change the default configuration.

1. Install JDK
Step 1: Install jdk-1_2_006-win.exe using the default configuration
The default installation directory of JDK is C: \ jdk1.4.1, and the default installation directory of JRE is C: \ Program Files \ mongooft \ JRE \ 1.4;
(For future convenience, you can select a well-remembered directory, such as c: \ jdk14 ;)

Step 2: Update Environment Variables
Start> Settings> Control Panel> system> advanced> environment variables> System Variables
The configuration is as follows:

JAVA_HOME = C: \ jdk1.4.1
CLASSPATH =.; % JAVA_HOME % \ lib \ tool. jar; % JAVA_HOME % \ lib \ dt. jar;
PATH =.; % JAVA_HOME % \ bin;

Ii. install Tomcat
Step 1: double-click the downloaded exe file. Enter the default installation path (you can select the installation path, for example, c: \ Tomcat4. Also, if you want to start Tomcat as a service of nt in the future, you can select NT serveer, this option)

Step 2: Double-click startup. bat to start the tomcat server
At this time, a dos window will appear on the screen, and some information about successful tomcat and initialization will be displayed,
Verify that tomcat runs successfully.

Step 4: Enter localhost: 8080/in the browser/
If you can see the Tomcat Version 4.06 page, it indicates that Tomcat is successfully installed.
The files on the page you see are stored in the c: \ jakarta-tomcat \ webapps \ examples directory (c: \ Tomcat4 \ webapps \ examples directory)
There are some examples of jsp and servlet, so far the jsp environment has been built.

Note: The above DOS window cannot be closed; otherwise, the tomcat server will stop service.

Note: JSP files run slowly for the first time

Iii. First JSP Example
Name test. jsp for this program and place it in the c: \ jakarta-tomcat \ webapps \ examples directory (c: \ Tom ...... the remaining full text>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.