I want to convert my http request to https using my self signed certificate. How to create my keystore files and add certificate in keystore,how to use this keystore file for converting http to https.
Please sort out this problem
Not sure if this helps but adding this code to htaccess will redirect all http to https:
<VirtualHost *:80>
ServerName www.example.com
Redirect "/" "https://www.example.com/"
</VirtualHost >
<VirtualHost *:443>
ServerName www.example.com
# ... SSL configuration goes here
</VirtualHost >
You can use KEYTOOL to generate a keypair along with Keystore below command will give you keystore which will have the private / public keypair
keytool -genkeypair -keysize 2048 -keyalg RSA -alias tempAlias -keystore /temp.keystore -ext SAN=dns:abc.com,dns:localhost,ip:xx.xx.xx.xx
to generate Self Signed Certificate use below command
keytool -export -alias tempAlias -keystore /temp.keystore -file /temp.crt
To import a certificate into your trsutstore
keytool -import -alias tempAlias -file PATH_TO_CRT_FILE -keystore PATH_TO_TRUSTSTORE
Depending on the server you can configure the server to make the request HTTPS for example in tomcat you need to update the connector tag in server.xml to something like below
<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/>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.