Bitnami WordPress NGINX SSL certificate Installation

Enable HTTPS secure server on your WordPress with NGINX and SSL Certified by Bitnami and Automattic stack image. This will make the website more secure, enhance the user experience, Boost SEO, and much more.

Install SSL certificate for your Bitnami nginx WordPress stack image.

You can install the SSL certificate for your Bitnami NGINX WordPress stack for free using Let’s Encrypt. For this, first of all, you’ve to set the domain name for your WordPress website.


Now open the SSL terminal of the virtual machine. If you don’t know how to open the terminal, learn here.

Generate SSL for your Domain

To generate SSL (Secure Sockets Layer) first, you’ve to get in with root permission.

Stop NGINX to generate SSL
Stop NGINX to generate SSL

Now stop the nginx server of your WordPress application. To exclude this operation paste the following command one by one.

sudo -i
sudo /opt/bitnami/ctlscript.sh stop nginx
Generate SSL Certificate Bitnami nginx
Generate SSL Certificate Bitnami nginx

Now generate a renewable SSL certificate for your website by executing the following.

sudo /opt/bitnami/letsencrypt/lego --tls --email="youremail@gmail.com " --domains="iasrank.in" --domains="www.iasrank.in" --path="/opt/bitnami/letsencrypt" run

In the above command, please replace email and domain names with your own values.

SSL certificate will be successfully generated for your blog. Now you’ve to configure your blog to serve using this SSL certificate.

Start NGINX server of WordPress.

Start NGINX services using SSH
Start Bitnami NGINX

Your Nginx server is turned off during the certificate generation. To turn it on executing the following command for bitnami NGINX.

sudo /opt/bitnami/ctlscript.sh start nginx

Configure Bitnami WordPress stack for SSL certificate

It’s time to configure your SSL certificate with the root of the WordPress application. This will enable nginx to find the certificate and redirect your domain to one preferred URL.

To provide a path to the nginx server, we’ve to edit bitnami.conf file of the stack. Execute the following command line. This will redirect bitnami WordPress redirect HTTP to HTTPS nginx.

nano /opt/bitnami/nginx/conf/bitnami/bitnami.conf
Redirect all traffic to one domain nginx settings
Bitnami configuration

Now we’ve to move all non-secure or HTTP traffic to the secure SSL or HTTPS server. To do this will add the following line to server 80:

return 301 https://iasrank.in$request_uri;

Change iasrank.in with the www or non-www version of your website. That means bitnami WordPress will redirect HTTP to HTTPS nginx. Now we point all traffic to one naked domain(in our case). And provide a path for the SSL certificate. Edit server 443, add the following lines.

Configuration to move www to non-www domain:

if ($host = 'www.iasrank.in') {
return 301 https://iasrank.in$request_uri;
ssl_certificate      "/opt/bitnami/letsencrypt/certificates/iasrank.in.crt";
ssl_certificate_key  "/opt/bitnami/letsencrypt/certificates/iasrank.in.key";

The above settings, redirect your traffic to https://iasrank.in or say a naked domain. To move all traffic to https://www.iasrank.in paste the code provided below instead of the above.

Configuration to move non-www traffic to www domain:

if ($host = 'iasrank.in') {
return 301 https://www.iasrank.in$request_uri;
ssl_certificate      "/opt/bitnami/letsencrypt/certificates/iasrank.in.crt";
ssl_certificate_key  "/opt/bitnami/letsencrypt/certificates/iasrank.in.key";

And now comment out previous SSL certificate files by adding #(hash) as displayed above. Now modified code will look like this(for old SSL)

#       ssl_certificate      server.crt;
#       ssl_certificate_key  server.key;

All done, save the file using ctrl+X, then Y, and then press enter button. Your changes will be saved.

Configure WordPress for SSL certificate.

You can configure WordPress by editing the wp-config.php file. To do that, execute the code provided below.

Edit wp-config.php NGINX WordPress bitnami
Edit wp-config.php NGINX WordPress bitnami
nano /opt/bitnami/apps/wordpress/htdocs/wp-config.php

This will open the wp-config.php file to the SSH editor.

Now replace http to https for your WordPress domain

define('WP_SITEURL', 'http://iasrank.in');
define('WP_HOME', 'http://iasrank.in');

replace with 

define('WP_SITEURL', 'https://iasrank.in');
define('WP_HOME', 'https://iasrank.in');

Now press ctrl+X, then Y, and press Enter to save the changes.

Test and Restart NGINX
Test and Restart Bitnami NGINX

Now in the final step, you’ve to test and restart NGINX. Execute nginx -t to test NGINX and restart. If any error occurs in the nginx configuration, please match the configuration as per the result.

nginx -t
sudo /opt/bitnami/ctlscript.sh restart nginx

Now all done, your Bintami WordPress now runs on HTTPS secure server with a Let’s Encrypt SSL certificate. If you’ve any questions regarding this, you can ask in the comment section below.

Ashok Kumar

Ashok Kumar working in the Search Engine Optimization field since 2015. And worked on many successful projects since then. He shares the real-life experience of best SEO practices with his followers on seoneurons.com. You also can learn Advance level SEO for WordPress, Blogger, or any other blogging platform. Stay tuned.

Related Articles

Leave a Reply

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