Tomcat 安裝與優化

1. JVM 配置

  • 添加 tomcat 管理員
[root@server ~]# vim /tomcat/conf/tomcat-users.xml
<role rolename="manager-gui"/>
<role rolename="admin-gui"/>
<user username="manager" password="manager" roles="admin-gui,manager-gui"/>
  • 修改 JVM 虛擬內存
JAVA_OPTS="-server -Xms1024m -Xmx1024m -Xmn256m -XX:PermSize=512m -XX:MaxPermSize=1024m -Djava.awt.headless=true -Dfile.encoding=utf-8"

2. apr 安裝

  • 安裝依賴
[root@server ~]# yum -y install gcc expat-devel
[root@server ~]# mkdir /usr/local/apr
[root@server apr-1.6.3]# ./configure --prefix=/usr/local/apr
[root@server apr-1.6.3]# make && make install
[root@server apr-util-1.6.1]# ./configure --prefix=/usr/local/apr --with-apr=/usr/local/apr
[root@server apr-util-1.6.1]# make && make install
[root@server ~]# cd tomcat-native-1.2.17-src/native/
[root@server native]# ./configure --prefix=/usr/local/apr --with-apr=/usr/local/apr --with-java-home=/usr/java/jdk1.7.0_80/
[root@server native]# make && make install
  • 修改 tomcat 配置
[root@server ~]# vim /tomcat/bin/catalina.sh
# 添加 CATALINA_OPTS
CATALINA_OPTS="-Djava.library.path=/usr/local/apr/lib"
[root@server ~]# vim /tomcat/conf/server.xml
<Connector port="8001"
    protocol="org.apache.coyote.http11.Http11AprProtocol"
    executor="tomcatThreadPool"
    maxThreads="1000"
    enableLookups="false"
    acceptCount="1000"
    connectionTimeout="30000"
    redirectPort="9100"
    maxPostSize="8388608"
    maxParameterCount="40000"
    disableUploadTimeout="true"
    URIEncoding="UTF-8"/>

3. SSLEngine Error

  • 查看 tomcat 日誌,出現 SSLEngine Error org.apache.catalina.core.AprLifecycleListener.lifecycleEvent Failed to initialize the SSLEngine. {:.error}java

  • 解決辦法apache

[root@server ~]# vim /tomcat/conf/server.xml
<Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="off" />
相關文章
相關標籤/搜索