inux tomcat配置https以及http訪問https
阿新 • • 發佈:2018-12-30
https://blog.csdn.net/sanshipianyezi/article/details/72737391 參考該作者,補充你兩點
1. 關於埠號的修改
<Connector port="443" protocol="org.apache.coyote.http11.Http11NioProtocol" maxThreads="150" SSLEnabled="true" scheme="https" secure="true" clientAuth="false" sslProtocol="TLS" keystoreFile="/user/software/tomcat-8.0.28-api/.keystore" keystorePass="passWord"/>
這邊修改為443後,http的埠號8080或者80的配置有一個埠號要修改
<Connector port="80" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="443" /> <!-- 注意 -->
還有一處
<Connector port="8009" protocol="AJP/1.3" redirectPort="443" />
2. 配置tomcat使http自動跳轉至https,配置conf裡的web.xml檔案
<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>
3. 重啟tomcat
測試訪問 會自動跳轉至https說明配置成功了
再次感謝原作者。