tomcat新增https服務
阿新 • • 發佈:2019-01-31
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