How to Install SSL Certificate in NGINX Server?

1 Star2 Stars3 Stars4 Stars5 Stars (8 votes, average: 4.88 out of 5)
Loading...
how to install ssl certificate in nginx server

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.

Also Read: How to Generate a CSR on NGINX Server?

Steps for Installing SSL Certificate in NGINX Server

Here are some quick steps for installing an SSL certificate into your NGINX webserver and displaying secure HTTPS URLs to prevent users from facing warning messages like “Not Secure”:

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;

ssl    on;

ssl_certificate    /etc/ssl/your_domain_name.pem; (or bundle.crt)

ssl_certificate_key    /etc/ssl/your_domain_name.key;

server_name your.domain.com;

access_log /var/log/nginx/nginx.vhost.access.log;

error_log /var/log/nginx/nginx.vhost.error.log;

location / {

root   /home/www/public_html/your.domain.com/public/;

index  index.html;

} }

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. Likewise, we recommend verifying it once using SSL Checker Tool to ensure the installed Wildcard SSL certificate works correctly.

Things to Take Care About Before Proceeding With Installation

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.

Janki Mehta

Janki Mehta

Janki Mehta is a Cyber-Security Enthusiast who constantly updates herself with new advancements in the Web/Cyber Security niche. Along with theoretical knowledge, she also implements her practical expertise in day-to-day tasks and helps others to protect themselves from threats.