搜一下吧,要不就是不用apr模式,也不用nio模式,直接用bio模式跑的,麻煩問一下,您們都是傻屌嗎?web
APR模式必需要用!!!!!apache
而後全他媽的用jks證書,而後再提取公鑰*.cer,而後再轉換爲*.pfx,而後再用openssl提取私鑰*.key??????????tomcat
這他媽什麼傻吊思路和操做?url
直接下載pem證書壓縮包不是一會兒就有了cer 和key甚至還送一個crt,各位傻屌大家是太顯仍是怕寫的簡單了小白看不懂呢?spa
正確的操做是:code
申請證書,最後一步下載證書的時候選擇:pem(默認 pem_apache)server
而後獲得壓縮包,這個壓縮包裏邊就分別保存了公鑰cer和私鑰key,送的crt用不着xml
而後打開打開tomcat的server.xmlblog
解除connector port=""8443"的註釋(而後再修改爲下邊代碼框中的內容)ssl
懶得弄得就直接複製下邊帖進去,位置隨意
<Connector port="443" protocol="org.apache.coyote.http11.Http11AprProtocol" SSLEnabled="true" maxThreads="150" scheme="https" secure="true" SSLCertificateFile="D:/www.xxx.com.cer" SSLCertificateKeyFile="D:/www.xxx.com.key" SSLVerifyClient="none" sslProtocol="TLS" />
若是須要把http訪問的重定向到https那麼還須要修改這裏
以及這裏
而後再去tomcat的conf文件夾下找到web.xml並在最後位置,添加以下內容
<login-config> <!-- Authorization setting for SSL --> <auth-method>CLIENT-CERT</auth-method> <realm-name>Client Cert Users-only Area</realm-name> </login-config> <security-constraint> <!-- Authorization setting for SSL --> <web-resource-collection > <web-resource-name >SSL</web-resource-name> <url-pattern>/*</url-pattern> </web-resource-collection> <user-data-constraint> <transport-guarantee>CONFIDENTIAL</transport-guarantee> </user-data-constraint> </security-constraint>
如圖
重啓tomcat服務,http就能夠重定向到https了