Home / Tutorials / How to create a SSL Certificate on Nginx for Centos

How to create a SSL Certificate on Nginx for Centos

Certificate SSL(Secure Sockets Layer) is encryption technology between clients and Server when transfer data. Make data secure and safe. It’s difficult to exploit from hackers. You can apply SSL to many applications such as SSL for FTP, VPN, Mail Service….

In this article, we will introduce to you guys How to create a SSL Certificate on Nginx for Centos:

1.Create Folder for Certificate

# mkdir /etc/nginx/ssl


Go to Folder ssl

# cd /etc/nginx/ssl


 2.Create Server Key And Certificate Signing Request

Create private server key, ***Note: keep pass in your mind when register

 # openssl genrsa -des3 -out server.key 1024


Create Certificate signing request

 # openssl req -new -key server.key -out server.csr

Next, you must fill information like below template, Keep in mind that , must match with your domain name or IP address, challenge password and optional company name will be left blank .

3.Remove Passphrase

# cp server.key server.key.org
# openssl rsa -in server.key.org -out server.key

4. Sign SSL Certificate

Register certificate will be expired in 1 year

 # openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt

5. Setup Certificate

Open SSL Config

# vim /etc/nginx/conf.d/ssl.conf

Edit HTTPS Server like below information:

# HTTPS server                                                                                                                                                    server   {                                                                                                                                                     listen 443;                                                                                                                                      server_name example.com;                                                                                                                         ssl on;                                                                                                                                                           ssl_certificate /etc/nginx/ssl/server.crt;                                                                                                 ssl_certificate_key /etc/nginx/ssl/server.key;                                                                                                                    }


Restart Nginx

#/etc/init.d/nginx restart


Go to https://your_domain.com, you will see it work well, it means that you configured successfully

Check Also

How to install Comodo SSL on VestaCP

How to install Comodo’s PositiveSSL certificate on VestaCP. The simple tutorial below will help you ...

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.