[英]converting http to https using self signed certificate
我想使用我的自簽名證書將http請求轉換為https。 如何創建我的密鑰庫文件並在密鑰庫中添加證書,如何使用此密鑰庫文件將http轉換為https。
請解決這個問題
不確定是否有幫助,但是將此代碼添加到htaccess中會將所有http重定向到https:
<VirtualHost *:80>
ServerName www.example.com
Redirect "/" "https://www.example.com/"
</VirtualHost >
<VirtualHost *:443>
ServerName www.example.com
# ... SSL configuration goes here
</VirtualHost >
您可以使用KEYTOOL以及下面的Keystore生成密鑰對,命令將為您提供具有私有/公共密鑰對的密鑰庫
keytool -genkeypair -keysize 2048 -keyalg RSA -alias tempAlias -keystore /temp.keystore -ext SAN=dns:abc.com,dns:localhost,ip:xx.xx.xx.xx
生成自簽名證書使用以下命令
keytool -export -alias tempAlias -keystore /temp.keystore -file /temp.crt
要將證書導入您的trsutstore
keytool -import -alias tempAlias -file PATH_TO_CRT_FILE -keystore PATH_TO_TRUSTSTORE
根據服務器的不同,您可以配置服務器以發出請求HTTPS,例如在tomcat中,您需要將server.xml中的connector標簽更新為如下所示的內容
<Connector SSLEnabled="true"
clientAuth="false"
keystoreFile=PATH_TO_KEYSTORE
keystorePass=KEYSTORE_PASSWORD maxThreads="150"
port="443" protocol="HTTP/1.1" scheme="https"
secure="true" sslProtocol="TLS"
truststoreFile=PATH_TO_TRUSTKEYSTORE
truststorePass=TRUSTSTORE_PASSWORD/>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.