Create Apache2 / Nginx Certificate Signing Request CSR on Ubuntu 18.04 LTS Server

presentation 1794128 640

Since Ubuntu 18.04 LTS was released, I have been doing some tests in my lab environment. the steps below is how I got a new CSR created for my domain and website.

When you want to install domain SSL/TLS certificates on your websites you need to get a certificate signing request file to the certificate authority.

Certificate signing request is the first step you take in acquiring trusted SSL/TLS certificates for your domain. Before you can generate SSL certificates, you must first generate or create a CSR file and provide that to the certificate authority. The authority will then use the request to generate a certificate for your server.

The CSR request contains information that will be used to create the certificate. These include, the organization name, common name (domain), locality, country and more.

It also contains the public key that is used to generate a certificate. A private key is also created during the time of the CSR creation.

This brief tutorial is going to show you how to easily generate a Certificate Signing Request for your Ubuntu 18.04 LTS servers

Step 1: Creating CSR on Ubuntu 18.04

When you’re ready to protect your website with SSL/TLS certificate, you must first generate a certificate signing request. This request contains information that is needed to generate a trusted certificate.

To generate a certificate for Apache2 webserver on Linux systems, logon to your computer as root and run the below command.

openssl req -new -newkey rsa:2048 -nodes -keyout -out

When you press the Enter key, you’ll then be asked series of question related to the certificate you’re requesting. Find the highlighted field below to give you an idea.

Generating a 2048 bit RSA private key
writing new private key to ''
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
Country Name (2 letter code) [AU]:US
State or Province Name (full name) [Some-State]:New York
Locality Name (eg, city) []:Brooklyn
Organization Name (eg, company) [Internet Widgits Pty Ltd]:EXAMPLE.COM
Organizational Unit Name (eg, section) []:SSL Unit
Common Name (e.g. server FQDN or YOUR name) []
Email Address []

Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:

It important that you leave the password field blank above, or you’ll be prompted always when you restart the web server.

This command creates the CSR file as well as the server’s private key file. The private key must be protected and kept very safe. This is very important.

Step 2: Send the CSR content to your certificate Authority

After you creating the request above, look into the same directory you ran the command and you’ll find a file named after your domain, called

Open the to view the content. Then copy and paste it to your certificate provider.

cat yourdomain.csr


Copy the entire content from the BEGIN to the END and send to the certificate authority. The authority will use the file to create a certificate you purchased and send it back to you. You then install the cert on the domain you want to protect.


You may also like this post:

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.