系统环境: centos6.7
jdk-7u79-linux-x64
apache-tomcat-7.0.57
apr-1.5.2
apr-util-1.5.4
一、tomcat安装
自己准备tomcat和jdk安装包 # cd /data/soft # tar xf apache-tomcat-7.0.57.tar.gz -C /usr/local/ # cd /usr/local # ln -sv apache-tomcat-7.0.57 tomcat # cd /data/soft # yum -y localinstall jdk-7u79-linux-x64.rpm #安装jdk # yum -y install openssl-devel #安装支持ssl # vim /etc/profile.d/java.sh #定义JAVA_HOME export JAVA_HOME=/usr/java/latest export PATH=$JAVA_HOME/bin:$PATH # vim /etc/profile.d/tomcat.sh #配置tomcat的环境变量 export CATALINA_BASE=/usr/local/tomcat export PATH=$CATALINA_BASE/bin:$PATH # source /etc/profile.d/tomcat.sh # source /etc/profile.d/java.sh # catalina.sh start #启动tomcat, 默认监听在8080端口
二、测试
获取下载地址 springmvc4 mybatis 整合 框架源码 bootstrap html5
三、配置tomcat的https服务
1、配置文件里面配置https服务 <Connector port="443" protocol="org.apache.coyote.http11.Http11AprProtocol" SSLEnabled="true" scheme="https" secure="true" maxThreads="300" acceptCount="1000" compression="on" compressionMinSize="2048" compressableMimeType="text/html,text/xml,text/javascript,text/css,text/plain" connectionTimeout="20000" enableLookups="false" SSLCertificateFile="/usr/local/tomcat/conf/localhost.crt" SSLCertificateKeyFile="/usr/local/tomcat/conf/localhost.key" clientAuth="false" sslProtocol="TLS" URIEncoding="utf-8"/> 2、安装apr、apr-util、tomcat-native 下载安装包 # wget http://mirrors.aliyun.com/apache/apr/apr-1.5.2.tar.gz # wget http://mirrors.aliyun.com/apache/apr/apr-util-1.5.4.tar.gz (1)安装apr # tar xf apr-1.5.2.tar.bz2 # cd apr-1.5.2 # ./configure && make && make install (2)安装apr-util # tar xf apr-util-1.5.4.tar.bz2 # cd apr-util-1.5.4 # ./configure --with-apr=/usr/local/apr && make && make install (3)安装tomcat-native # cp /usr/local/tomcat/bin/tomcat-native.tar.gz ./ # tar xf tomcat-native.tar.gz # cd tomcat-native-1.1.32-src/jni/native/ # ln -sv /usr/java/jdk1.7.0_79/ /usr/java/jdk # ./configure --with-apr=/usr/local/apr --with-java-home=/usr/java/jdk # make && make install (4)载入apr库 # vim /etc/profile.d/tomcat.sh export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE INPUTRC JAVA_HOME #tomcat-apr export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/apr/lib # source /etc/profile.d/tomcat.sh 注意:我这里有有现成的key和crt,如果没有,清自己生成 四、查看https服务是否正常 # /usr/local/tomcat/bin/startup.sh #启动tomcat # netstat -tnlp|grep javan #443端口已经监听 tcp 0 0 ::ffff:127.0.0.1:8005 :::* LISTEN 3189/java tcp 0 0 :::8009 :::* LISTEN 3189/java tcp 0 0 :::8080 :::* LISTEN 3189/java tcp 0 0 :::443 :::* LISTEN 3189/java