系統環境: centos6.7 jdk-7u79-linux-x64 apache-tomcat-7.0.57 apr-1.5.2 apr-util-1.5.4 一、tomcat安裝 二、測試 獲取下載地址 springmvc4 mybatis 整合 框架源碼 bootstrap html5 三、配 ...
系統環境: 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