SSL小記

1. 生成ssl證書

這個是測試生成的ssl證書,在訪問路徑的時候會出現,證書不可靠。這個是正常的,因爲證書沒有經過第三方的認證,所以會有不可靠的說法。

2. 生成ssl路徑

如果沒有ssl路徑直接在tomcat上添加證書路徑也是讀取不到的。是有問題的。

3. 修改tomcat -> conf/server.xml, 這樣http 和https都能夠訪問

<Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"  
    maxThreads="150" scheme="https" secure="true" clientAuth="false"  
    sslProtocol="TLS" keystoreFile="C:/Users/Administrator/Desktop/ssl/testssl"  
    keystorePass="testssl" />  

4. 在項目的web.xml裏面添加

<security-constraint>  
    <web-resource-collection>  
        <web-resource-name>secured page</web-resource-name>  
        <url-pattern>/*</url-pattern>  
    </web-resource-collection>  
    <user-data-constraint>  
        <transport-guarantee>CONFIDENTIAL</transport-guarantee>  
    </user-data-constraint>  
</security-constraint> 

5. 此外server.xml中需要添加,這樣就會使的頁面定向到https(這個可加可不加,沒有什麼太大的影響)

<Connector port="8080" maxHttpHeaderSize="8192" maxThreads="150"  
    minSpareThreads="25" maxSpareThreads="75" enableLookups="false"  
    redirectPort="8443" acceptCount="100" connectionTimeout="20000"  
    disableUploadTimeout="true" />  

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章