SecurityCategory

Ubuntu Nginx SSL: How to install an SSL certificate on Ubuntu for Nginx

5 min read
Steven Vaughan-Nichols
Plane engine to represent Nginx for post on installing an SSL certificate on Ubuntu.

Did you install an SSL certificate on your Ubuntu hosted server using Nginx as the Web server? If not, why risk blowing your website security? With hackers targeting businesses large and small, even Google is strongly encouraging website owners to get implement SSL certificates. The search engine boosts search rankings web pages and blog posts that encrypt transmissions with the https:// prefix. Now, that type of security requires an X.509 Digital Certificate, commonly referred to as a Secure Sockets Layer or SSL certificate.

To get started, you’ll first need to acquire a digital certificate, then install it on an Ubuntu hosted server using Nginx as the Web server. Read on for a bit of background on the certificates and exact steps for installing.

Go from idea to online in minutes with GoDaddy Airo™

Get started now.

Available SSL digital certificates for a Nginx server on Ubuntu

A trusted third party called a Certificate Authority (CA) issues the three types of digital certificates: Domain Validation (DV), Organization Validation (OV), and Extended Validation (EV). The CA guarantees the digital certificate's authenticity with a digital signature so that end users (or their software) can trust that the server is really the site it purports to be. Not sure which digital certificate is your best bet? I’ve detailed each below, listing them from least to most secure.

Domain Validation (DV)

Domain Validation certificate states that the domain is registered by someone with admin rights to the website. If the certificate is valid and signed by a trusted CA, a browser connecting to the site will inform you that it has successfully secured an HTTPS connection. A DV is all you need to secure a blog or simple website.

Organization Validation (OV)

An Organization Validation certificate validates the domain ownership and includes ownership information such as the site owner's name, city, state, and country.

Extended Validation (EV)

An Extended Validation certificate authenticates the domain ownership and organization information, as well as your organization’s legal existence. This is the go-to certificate for those engaging in e-commerce. In many browsers, you can easily identify websites with an EV SSL certificate by their green address bars.

How to secure the service with an SSL certificate

To get started, you’ll first need to purchase or acquire the SSL certificate. If needed, here are additional details on how to request an SSL certificate and verify it.

If you have purchased a CA-approved SSL certificate, delivery might take from hours for a DV to weeks for an EV. The CA will inform you when the certificate is ready for download. Here’s how to retrieve it in seven steps:

  1. Log into Account Manager.
  2. Click SSL Certificates.
  3. Pick the certificate you want to use and click Manage.
  4. Next to the certificate you want to use, in the Actions column, click View Status.
  5. Click Download.
  6. Select the server type, and then click Download Zip File.
  7. Safely store the downloaded file for the future.

How to install an SSL certificate for the Nginx server on Ubuntu

Installing an SSL digital certificate for Nginx won’t bust the brain.

1. Log into the server using SSH.

2. Check the OpenSSL client software.

Make sure the OpenSSL client software needed for a secure website is in place with:

$ sudo apt-get mod_ssl openssl

This will either install OpenSSL or inform you that it’s already present.

3. Make a directory to store the server key and certificate.

$ sudo mkdir mkdir /etc/nginx/ssl

4. Copy the SSL certificate file and server key.

$ sudo cp server.crt /etc/nginx/ssl
$ sudo cp server.key /etc/nginx/ssl

5. Edit the ssl.conf or httpd.conf file.

Here’s an example using the vi text processor:

$ sudo vi //etc/nginx/sites-available/default/your_very_own_domain.com

Once open, the file can be edited so that it points to the correct files in the Web server. It will look something like:

server {
listen  80;
listen 443 ssl;

ssl on;
ssl_certificate /etc/ssl/your_domain_name.pem; 
ssl_certificate_key /etc/ssl/your_domain_name.key;

server_name your_very_own_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_very_own_domain.com/public/;
index index.html;
}
}

6. Restart the Web server.

Use the following command to restart the Web server:

$ sudo /etc/init.d/nginx restart

The secured site should be available at https://www.your_very_own_domain.com.

Learn about the four types of SSL certificates available:

Wildcard SSL Certificate
Extended Validation SSL Certificate
SAN SSL Certificate
Organization Validation SSL Certificate


Efficiently deliver better results.

When you use The Hub from GoDaddy Pro, suddenly there’s more time in your day to focus on what matters most. Forget about juggling admin tasks. Reclaim your time and use it to make clients feel like the center of your universe.

Sign up for Free

Products Used