How to Install SSL Certificate in NGINX?
After getting your desired SSL certificate issued, you’ll need to go one step further and install the issued SSL certificate into your NGINX webserver to prevent the “Not Secure” warning. In addition, if you’re using the NGINX server, then go through the below steps and get your issued SSL certificate installed.
Prerequisites
Ensure you have the below-mentioned certificate files:
Server Certificate
The server certificate for your website comes in an email sent by the certificate authority. Nonetheless, if you haven’t received an email, you can get your server certificate. All you need to do is download it through an SSL order from the Account Dashboard.
Intermediate Certificate
An intermediate certificate connects the device with the server to identify who has issued an installed SSL certificate. If you have received the ZIP folder of the CA certificates, you’ll find it within that folder. Also, you can download the CA Bundle for your SSL certificate if you haven’t received an email.
Private Key
The private key is kept on your web server. Likewise, you’ll have a private key if you’ve generated the CSR. It’s recommended that you keep the private key with you securely. Lastly, you’ll also require this file at the time of installation.
Note: If you don’t have CSR, follow the Steps to Generate CSR in NGINX
Steps for Installing SSL Certificate in NGINX Server
Here are some quick steps for installing an SSL certificate into your NGINX:
Copy SSL Certificate Files
Firstly, you’ll need to copy and save all the certificate files in an appropriate directory within the NGINX server. And, for better security, keep it in readable format through the root.
You’ll be required to concatenate two certificates into a single file using the below-mentioned command:
cat your_domain_exmaple_name.crt Intermediate.crt >> bundle.crt
Edit virtual host file of NGINX server. And, for editing, all you have to do is copy the existing server module into the secure one and paste it into the original:
server {
listen 443;
server_name domainname.com;
ssl on;
ssl_certificate /etc/ssl/certs/ssl-bundle.crt;
ssl_certificate_key /etc/ssl/private/domainname.key;
ssl_prefer_server_ciphers on;
}
And once you submit the code mentioned above, you’ll require to restart the server using the NGINX server:
sudo /etc/init.d/nginx restart
Congratulations! Once you complete the abovementioned steps, your SSL is installed in your NGINX webserver.
Final Words
Likewise, we recommend verifying it once using SSL Checker Tool to ensure the installed SSL certificate works correctly.