tomcat生产环境配置

window下, 在catalina.bat最前面:

set JAVA_OPTS=-XX:PermSize=64M -XX:MaxPermSize=128m -Xms512m -Xmx1024m;-Duser.timezone=GMT+08;

一定加在catalina.bat最前面。

linux下,在catalina.sh最前面增加:

JAVA_OPTS="-XX:PermSize=64M -XX:MaxPermSize=128m -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>

时间: 2024-10-21 10:00:09

tomcat生产环境配置的相关文章

虚拟机上Centos6.5/6.6系统配置动态方式上网及生产环境配置公网的方式

在VMware Workstation虚拟机上安装Centos系统,当系统无法上网的时候,我们可以通过常用配置的方式,如下: TYPE=Ethernet DEVICE=eth0  #网络虚拟接口名HWADDR=00:0C:29:60:FF:8B  #网卡mac地址ONBOOT=yes  #启动系统时就激活 NM_CONTROLLED=yes  #实时生效,修改后无需要重启网卡立即生效. BOOTPROTO=dhcp #使用自动分配IP地址 注意:虚拟机网络连接方式选择NAT 当我们使用服务器上安

SQL Server 黑盒跟踪 -- 如何在生产环境配置?

SQL Server 黑盒跟踪 -- 如何在生产环境配置? 如果遇到间歇性故障,为了充分利用黑盒跟踪,就要确保当服务器运行时它也一直出于运行状态(包括计划中的或计划外重启之后).为达到这个要求,可以将黑盒跟踪设置为在SQL Server启动时自动启动.首先,将跟踪定义封装在主数据库的一个存储过程中: USE master GO CREATE PROCEDURE StartBlackBoxTrace AS BEGIN DECLARE @TraceId int DECLARE @maxfilesiz

webpack开发与生产环境配置

前言 作者去年就开始使用webpack, 最早的接触就来自于vue-cli.那个时候工作重点主要也是 vue 的使用,对webpack的配置是知之甚少,期间有问题也是询问大牛 @吕大豹.顺便说一句,对于前端知识体系迷茫的童鞋可以关注豹哥的微信公众号,<大豹杂说>.豹哥对于刚开始小白的自己(虽然现在也白)知无不谈,而且回复超快超认真.这里真的很感谢豹哥.前段时间工作不忙,自己就啃了啃webpack的官方文档,毕竟知识还是在自己脑袋里踏实.然后根据vue-cli的配置文件丰富了一点新的东西,发布出

[django]Django的css、image和js静态文件生产环境配置

前言:在Django中HTML文件如果采用外联的方式引入css,js文件或者image图片,一般采用<link rel="stylesheet" href="../css/lstyle.css">这个格式,但是django中需要配置一下,才能如此使用. 关键词:django静态文件 django生产环境 django1.8 正文: 第一步,在django工程目录下建立static文件夹,同时在static文件夹下建立css img js三个不同名称的文件

【图文讲解】TomCat服务器环境配置及项目部署

转载请注明出处:http://blog.csdn.net/caoyouxing/article/details/42644575 如何下载安装tomcat?如何配置环境变量?如何部署项目?在这过程中是否和作者一样经常出现错误? 请仔细读文及注意事项. 工具/原料 1,JDK:版本为jdk-7-windows-i586.exe 下载地址http://www.oracle.com/technetwork/java/javase/downloads/index.html 2,tomcat:版本为apa

hbase centOS生产环境配置笔记 (1 NameNode, 1 ResourceManager, 3 DataNode)

本次是第一次在生产环境部署HBase,本文若有配置上的不妥之处还请高手指正. hadoop版本:hadoop-2.4.1 HBase版本:hbase-0.98.6.1-hadoop2 JDK:1.6 操作系统:centOS6.3 64bit 1. 安装snappy #yum install snappyInstalled: snappy.x86_64 0:1.1.0-1.el6 #yum install snappy-devel 记录一下,当前GCC版本4.4.7 2. 由于hadoop官网下载

搭建vsftp服务器生产环境配置

生产环境:操作系统:CentOS release 6.9 (Final)软件:vsftpd-2.2.2-24.el6.x86_64实战任务:给定账号,让开发商上传站群代码到服务器的指定目录,可以读写:操作过程如下:一.配置防火墙,开启FTP服务器需要的端口[[email protected] /]# vi /etc/sysconfig/iptables    #添加端口号-A INPUT -m state --state NEW -m tcp -p tcp --dport 21 -j ACCEP

docker的安装以及jdk和tomcat的环境配置

准备工作:需要Linux kernel 3.8支持查看linux内核的版本:[email protected]:~# cat /proc/version查看linux版本:[email protected]:~# lsb_release –a 关于dockerDocker 是一个开源的应用容器引擎,让开发者可以打包他们的应用以及依赖包到一个可移植的容器中,然后发布到任何流行的 Linux 机器上,也可以实现虚拟化.容器是完全使用沙箱机制,相互之间不会有任何接口(类似 iPhone 的 app).

Docker生产环境配置——设置direct-lvm模式

CentOS/RHEL 的用户需要注意的事项 来源:https://yeasy.gitbooks.io/docker_practice/image/rm.html 在 Ubuntu/Debian 上有 UnionFS 可以使用,如 aufs 或者 overlay2,而 CentOS 和 RHEL 的内核中没有相关驱动.因此对于这类系统,一般使用 devicemapper 驱动利用 LVM 的一些机制来模拟分层存储.这样的做法除了性能比较差外,稳定性一般也不好,而且配置相对复杂.Docker 安装