Installing free SSL on AWS EC2 machine( Meteor version 1.6) using LetsEncrypt
By Philomathes in Web Development
It’s delivery time in VAYUZ. Couple of project already on the production environment and some are in the last sprint. And every Developer will agree with me that the last sprint of any project is the longest sprint. Configuring an environment to a live server is a big task altogether. And if it’s on AWS, then it throws more challenges to the developers like Memory Management, SSL configuration etc.
Recently we deployed one of the variant of our social Networking engine “BITOVN” on AWS. Except one issue, we were done with all the tests and checks on the Production Environment. And the only issue which was left was the installation of SSL on the EC2 instance. Since this product is completely powered by JS ecosystem(Node in Backend, meteor in frontend), this became a different challenge all together.
Installation of meteor project on AWS itself could be a real headache if you are not familiar with AWS environment. But SSL certificate installation is one such process that usually causes severe pain for the Developers. And we also faced the same problem. Like every developer we Googled for this problem but most of the content which was available on the web for this issue is almost 2-3 years old. And many things has changed since then. We somehow finally managed to add the SSL certificate after many hits and trails.
Post that we felt a need for an article which can help others who are doing the same task and facing the problem that we faced. So here is a solution to your problem. This blog will help you in setting up free SSL certificate on AWS EC2 instance. Let’s start.
Installation Steps
- Login with SSH command on your Ubuntu machine.
- Go to your project directory by typing – cd /var/www/html/
- Go inside your project folder, then in app-deploy folder and run the following command – mup stop
- This command will stop the current instance that is running on the AWS.
- Next step is to move out of the current folder by using the following command
- cd ..
- And then move to the following location – var/www/html.
- You can use the following command to move to HTML folder – cd /var/www/html/
- Now lets install LetsEncrypt on your virtual machine.
- Let’s Encrypt is a certificate authority that provides free X.509 certificates for Transport Layer Security (TLS) encryption via an automated process designed to eliminate the hitherto complex process of manual creation, validation, signing, installation, and renewal of certificates for secure websites.
- type this command to install LetsEncrypt- git clone https://github.com/letsencrypt/letsencrypt
- Now go inside LetsEncrypt folder with –
- cd letsencrypt
- Next step is to generate the required SSL certificate with the command
- ./letsencrypt-auto certonly –standalone
- Once this command is executed, it will give you the path where your certificates were generated. So navigate to that folder with this command –
- cd /etc/letsencrypt/live/YourSiteName.com
- Next step is changing the permission for the following folders –
- chmod go+x /etc/letsencrypt/archive
- chmod go+x /etc/letsencrypt/live
- Go back to your project & then inside app deploy and restart your mup instance with command – mup start
- Post this command your machine is back in the game. Congrats you have installed SSL successfully on the server.
- Since SSL is up we want all the users to access the platform through HTTPS even though he has used HTTP at his end. And to do so we need to add forcessl package. Following is the command to add forcessl package –
- meteor add force-ssl
- In your mup.js file add this
meteor: {
name: ‘YourSiteName’,
path: ‘../../YourSiteName’,
servers: {
one: {}
},ssl: {
crt: “/etc/letsencrypt/live/YourSiteName.com/fullchain.pem”,
key:”/etc/letsencrypt/live/YourSiteName.com/privkey.pem”,
port: 443
},
buildOptions: {
serverOnly: true,
},
env: {
ROOT_URL: ‘https://YourSiteName.com’,
MONGO_URL: ‘mongodb://localhost/meteor’
},
dockerImage: ‘abernix/meteord:node-8.4.0-base’,
deployCheckWaitTime: 60,
enableUploadProgressBar: true,
} - Save these changes.
- Setup mup and redeploy it again with command
- mup setup && mup deploy
Once this is Complete, SSL would be installed on our website. Enjoy free SSL for next 3 months. If you like this article, please like, share and comment. Have a great day.
Leave a Comment
You must be logged in to post a comment.