{"id":962,"date":"2016-12-29T12:45:37","date_gmt":"2016-12-29T07:15:37","guid":{"rendered":"https:\/\/pheonixsolutions.com\/blog\/?p=962"},"modified":"2026-09-11T21:11:27","modified_gmt":"2026-09-11T15:41:27","slug":"install-ssl-certificate-nginx-ubuntu-16-04","status":"publish","type":"post","link":"https:\/\/pheonixsolutions.com\/blog\/install-ssl-certificate-nginx-ubuntu-16-04\/","title":{"rendered":"Install SSL Certificate on Nginx Ubuntu 16.04"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">Introduction<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Nginx is a high-performance web server commonly used to host websites and web applications. Installing an SSL certificate helps secure communication between the website and its visitors by enabling HTTPS.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In this article, we will explain how to install and configure an SSL certificate on an <strong>Nginx web server running Ubuntu 16.04<\/strong>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Prerequisites<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Before proceeding, make sure you have the following:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Ubuntu 16.04 server.<\/li>\n\n\n\n<li>Nginx web server installed and configured.<\/li>\n\n\n\n<li>Root or sudo access to the server.<\/li>\n\n\n\n<li>SSL private key.<\/li>\n\n\n\n<li>SSL certificate.<\/li>\n\n\n\n<li>Intermediate CA certificate.<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">If the SSL certificate signing request (CSR) was generated on the same server, make sure the corresponding private key is available on the server.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If Nginx is not installed, install and configure Nginx before proceeding.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Implementation<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">1. Create an SSL Directory<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">This article assumes that Nginx is installed under <code>\/etc\/nginx<\/code>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Create a directory to store the SSL certificate and private key:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">mkdir \/etc\/nginx\/ssl<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">2. Copy the Private Key<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Copy the SSL private key to the newly created directory:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">cp \/location\/domain.tld.key \/etc\/nginx\/ssl\/<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Replace <code>\/location\/domain.tld.key<\/code> with the actual location of your private key.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Make sure the private key has appropriate permissions and is accessible only to authorized users.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">3. Copy the SSL Certificate and Intermediate CA<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Copy the SSL certificate and intermediate CA certificate to the server.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For example, the files may be available under:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">\/usr\/local\/src\/domain.tld.crt<br>\/usr\/local\/src\/domain.tld.ca<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The certificate and intermediate CA can be transferred to the server using an appropriate secure file transfer method.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">4. Combine the Certificate and Intermediate CA<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Combine the SSL certificate and intermediate CA into a single PEM file:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">cd \/usr\/local\/src<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Then run:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">cat domain.tld.crt domain.tld.ca > \/etc\/nginx\/ssl\/domain.tld.pem<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The resulting PEM file will contain both the domain certificate and intermediate CA certificate.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">5. Configure SSL Ciphers<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Open the main Nginx configuration file:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">vi \/etc\/nginx\/nginx.conf<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Add or update the SSL cipher configuration after the appropriate SSL configuration:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">ssl_ciphers EECDH+CHACHA20:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5;<\/pre>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">For older Nginx\/OpenSSL versions, available cipher suites may differ. Verify compatibility with the installed Nginx and OpenSSL versions before applying a production configuration.<\/p>\n<\/blockquote>\n\n\n\n<h3 class=\"wp-block-heading\">6. Configure the SSL Certificate for the Website<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Open the website&#8217;s Nginx configuration file.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For this example, we assume the website configuration is:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">vi \/etc\/nginx\/sites-enabled\/default<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">If multiple websites are hosted on the server, update the configuration file corresponding to the required domain.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Add the HTTPS server block:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">server {<br>    listen 443 ssl http2 default_server;<br>    listen [::]:443 ssl http2 default_server;<br><br>    root \/var\/www\/html;<br><br>    ssl_certificate \/etc\/nginx\/ssl\/domain.tld.pem;<br>    ssl_certificate_key \/etc\/nginx\/ssl\/domain.tld.key;<br><br>    index index.php index.html index.htm;<br><br>    server_name domain.tld www.domain.tld;<br><br>    location \/ {<br>        try_files $uri $uri\/ \/index.php?$args;<br>    }<br>}<br><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Update the following values according to your environment:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>domain.tld<\/code> \u2014 Replace with your actual domain.<\/li>\n\n\n\n<li><code>\/var\/www\/html<\/code> \u2014 Replace with the actual website document root.<\/li>\n\n\n\n<li>SSL certificate and private key paths \u2014 Update if different.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">7. Check the Nginx Configuration<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Before restarting Nginx, always test the configuration:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">nginx -t<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">A successful configuration test should return:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">syntax is ok<br>test is successful<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">If Nginx reports an error, fix the configuration before proceeding.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">8. Restart Nginx<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Once the configuration test is successful, restart Nginx:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">systemctl restart nginx<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">You can also verify the Nginx service status:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">systemctl status nginx<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Verification<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Open the website using HTTPS:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">https:\/\/domain.tld<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">You can also verify the SSL certificate using an SSL testing service.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For example, use the <strong>SSL Labs SSL Server Test<\/strong> and enter your domain to check the certificate, certificate chain, supported protocols, and cipher configuration.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Installing an SSL certificate on Nginx enables HTTPS and helps protect communication between the website and its visitors.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The basic process involves copying the private key and certificates to the server, combining the certificate and intermediate CA, updating the Nginx configuration, testing the configuration, and restarting Nginx.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Always run <code>nginx -t<\/code> before restarting Nginx to avoid configuration-related service interruptions.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">FAQs<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">1. What files are required to install an SSL certificate on Nginx?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">You generally need the <strong>private key<\/strong>, <strong>SSL certificate<\/strong>, and <strong>intermediate CA certificate<\/strong> provided by the certificate authority.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">2. Where should I store the SSL certificate and private key?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">In this example, they are stored under:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">\/etc\/nginx\/ssl\/<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The private key should be protected with appropriate file permissions.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">3. Why do we combine the SSL certificate and intermediate CA?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Combining them into a PEM file allows Nginx to provide the required certificate chain to clients during the TLS connection.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">4. How can I check whether the Nginx configuration is correct?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Run:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">nginx -t<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Do not restart Nginx if this command reports an error.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Related Article<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/pheonixsolutions.com\/blog\/how-to-setup-ssl-certificate-in-nginx-on-ubuntu-20-04\/\">How to setup SSL Certificate in Nginx on Ubuntu 20.04 &#8211; Pheonix Solutions<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/pheonixsolutions.com\/blog\/install-nginx-on-cpanel-using-engintron\/\">Install Nginx on cPanel Using Engintron (Step-by-Step Guide)<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Talk to our experts<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Have a technology challenge or looking for the right solution for your business? Our team can help you with&nbsp;<strong>cloud, DevOps, development, infrastructure, design, and more<\/strong>. Feel free to reach out to our experts&nbsp;<a href=\"https:\/\/pheonixsolutions.com\/contact\">here<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction Nginx is a high-performance web server commonly used to host websites and web applications. Installing an SSL certificate helps [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":true,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[1024],"tags":[271,277,206,274],"class_list":["post-962","post","type-post","status-publish","format-standard","hentry","category-security","tag-nginx","tag-ssl","tag-ssl-certificate-installation","tag-ubuntu","psol-cat-security"],"jetpack_publicize_connections":[],"jetpack_shortlink":"https:\/\/wp.me\/phn2x7-fw","jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/962","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/comments?post=962"}],"version-history":[{"count":1,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/962\/revisions"}],"predecessor-version":[{"id":11672,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/962\/revisions\/11672"}],"wp:attachment":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=962"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=962"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=962"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}