To enable HTTPS for your website you’ll need to get and configure the required SSL/TLS certificates on your server. Start with choosing a trusted certificate provider. There are many authorities who give certificate free for 90 days. "Let’s Encrypt" is most popular open Certificate Authority. "SSL for free" issues certificates using "Let’s Encrypt"
1. Go to SSL FOR FREE
2. Enter your website to secure ( IP address do not work, you have to enter a registered domain name )
3. Select Manual Verification ( DNS ) option
4. Manually verify Domain
5. Go into the DNS management page that your domain and add TXT records with given key and value.
6. Now download SSL certificate.
The downloaded archive will have a certificate, bundle, and key. Extract the zip file and copy certificate and key to your ubuntu server.
Now you have to install this certificate in client and server.
Client Installation.
For the angular client, you need to add the following options to ng serve command in the package.json
--port 443 --disableHostCheck true --ssl --ssl-cert /home/ubuntu/certificate.crt --ssl-key /home/ubuntu/private.key
Note that port is 443. You have to open the port 443 in your security Group/ Firewall.
Restart client.
Server Installation.
This tutorial assumes that your server is Java Spring Boot.
You need to generate a key store for the server.
openssl pkcs12 -export -in certificate.crt -inkey private.key -out keystore.p12 -name server
This above step will ask for a password. Please enter the password and remember it.
Go to application.properties file and add following key value pairs.
For python Flask Server.
Now you can access your website using https://your-domain.com
Also, import the certificate to java trust store.
Import to trust store :
keytool -import -alias server -keystore /usr/lib/jvm/java-8-oracle/jre/lib/security/cacerts -file /home/ubuntu/certificate.crt
To know your java home on ubuntu
readlink -f /usr/bin/java | sed "s:bin/java::"
$(readlink -f /usr/bin/java | sed "s:bin/java::")lib/security/cacerts
This comment has been removed by the author.
ReplyDeleteIt was a great information. Thanks for sharing.very interesting to see this content
ReplyDeleteC and C++ Training Institute in chennai | C and C++ Training Institute in anna nagar | C and C++ Training Institute in omr | C and C++ Training Institute in porur | C and C++ Training Institute in tambaram | C and C++ Training Institute in velachery
Thank you for sharing this valuable post.
ReplyDeleteAngularJS training in chennai | AngularJS training in anna nagar | AngularJS training in omr | AngularJS training in porur | AngularJS training in tambaram | AngularJS training in velachery