Install WordPress (Bitnami), SSL and NGINX on Google Cloud

1 Star2 Stars3 Stars4 Stars5 Stars (3 votes, avr: 5.00)

Google Cloud Platform (GCP) offers pre-defined templates that you can use to deploy common solutions with Deployment Manager. These templates are offered as part of GCP Marketplace and can be found in the Google Cloud Platform Console, one of them install WordPress (Bitnami), SSL and NGINX

This tutorial demonstrates step by step install and configuration WordPress (Bitnami), SSL and NGINX with greatly simplifies creating deployments on Deployment Manager.

Prerequisites

Before starting with this guide, make sure you are able to use the Google Cloud Platform Console and the gcloudcommand-line tool SSH. on this tutorial we will use testing subdomain lab.axfon.com


Step 1: Install WordPress

There are multiple templates versions of WordPress on Google Cloud Marketplace, on this tutorial we are going to use WordPress with NGINX and SSL Certified by Bitnami, let’s install it

Go to Left Sidebar Menu ➝ Marketplace ➝ On input search box type “WordPress”  then find WordPress with NGINX and SSL Certified by Bitnami


You will be directed to deploy form, set VM name as your own, choose Instance zone location and let others default value

  1. Set name for deployment (you may change with your prefer name)
  2. Select zone location (recommended choose the closest location with your target country)
  3. Machine type it recommended min small 1 share CPU
  4. Boost disk type recommended SSD
  5. Deploy (let others default value)

Step 2: Reserve a Static IP Address (Optional)

A static/external IP address is an external IP address that is reserved for your VM Instance or other projects. You can reserve that IP address so that only your project can use it. Reserving static IP is an Optional you still can use external (dynamic) IP provided by default when creating a project.

Go to Left Sidebar Menu ➝ VPC network ➝ External IP Addresses ➝ On the above menu click “RESERVE A STATIC ADDRESS”

  1. Set name for your reserve static IP
  2. IP Type select Regional
  3. On Region select the same region as your VM Instance Region already deployed on step 1
  4. Attached by selecting VM Instance name
  5. Reserve

There are multiple versions of WordPress on Google Cloud


Step 3: Configure Domain to IP Address

Got to domain provider to create or add A record and pointing to static IP address

  1. Your domain name (On the picture we used a subdomain for testing)
  2. Set IP address
  3. Save

DNS or IP Address changes usually take 24 to 48 hours to propagation for fully start working


Step 4: Install SSL

SSL (Secure Sockets Layer) is a standard security protocol for establishing encrypted. If you don’t have own SSL certificate and want to enable HTTPS (SSL/TLS) on the website, we recommended to use Let’s Encrypt, it is a free, automated, and open certificate authority (CA)

Go to Left Sidebar Menu ➝ Deployment Manager ➝ Deployments ➝ Click on your project name

  1. User and Password information for your WordPress Admin
  2. Click on SSH to install SSL

To install SSL Let’s Encrypt certificate, for this example we used both www and non-www lab.axfon.com and www.lab.axfon.com Don’t forget to change it with your domain name and email address

sudo /opt/bitnami/letsencrypt/scripts/generate-certificate.sh -m i
nfo@axfon.com -d lab.axfon.com -d www.lab.axfon.com

If prompted confirmation type Y and ENTER to continue

Restart the NGINX server

sudo /opt/bitnami/ctlscript.sh restart nginx

You should now be able to access your application using an HTTPS URL, let’s see on url SSL Let’sencript worked perfectly and on the page showed Bitnami banner icon


Step 5: Configure Redirect Http to Https

The default server block file Bitnami NGINX is in directory /opt/bitnami/nginx/conf/bitnami/bitnami.conf  modify these file use nano editor

sudo nano /opt/bitnami/nginx/conf/bitnami/bitnami.conf

Add this code return 301 https://(www).$host$request_uri if you don’t want www just remove it

server {
      listen 80;
      server_name localhost;
      return 301 https://$host$request_uri;
      include "/opt/bitnami/nginx/conf/bitnami/bitnami-apps-prefix.conf";
}

Press Ctrl/Cmd + X and then press Y and ENTER to save changes

Changes made in the NGINX configuration file will not be applied until the command to Restart

sudo /opt/bitnami/ctlscript.sh restart nginx

Step 6: Change WordPress Address (url) Bitnami

The default WordPress files are in the directory /home/bitnami/apps/wordpress/htdocs  we need to modify a file wp-config.php

sudo nano /home/bitnami/apps/wordpress/htdocs/wp-config.php

To edit these file you may find WP_SITEURL and WP_HOME or you can use Cmd/Ctrl W to search and replace http with https

define('WP_SITEURL', 'https://' . $_SERVER['HTTP_HOST'] . '/');
define('WP_HOME', 'https://' . $_SERVER['HTTP_HOST'] . '/');

Press Ctrl/Cmd + X and then press Y and ENTER to save changes

You can now view WordPress admin page in your web browser by visiting your domain name or public IP address followed by /wp-admin full admin url http://your_domain_or_IP/wp-admin Login with Username and Password


Step 7: PHP File Upload Limit

The default PHP file configuration is in directory /opt/bitnami/php/etc/ and we need to modify a file php.ini

sudo nano /opt/bitnami/php/etc/php.ini

To edit these file you may find or use Cmd/Ctrl W to search

post_max_size = 100M
upload_max_filesize = 100M

Press Ctrl/Cmd + X and then press Y and ENTER to save changes

Changes made in the NGINX configuration file will not be applied until the command to Restart

sudo /opt/bitnami/ctlscript.sh restart nginx

Step 8: How to Remove Bitnami Banner Logo (Optional)

The Default page is including Bitnami banner Logo it’s useful links to documentation. If you want to remove this banner you have to set disable bnconfig to be True, to do this use the command below

sudo /opt/bitnami/apps/wordpress/bnconfig --disable_banner 1

If this tutorial could help you, please rate above Star button rating and share to help others find it! Feel free to leave a comment below.

Recommended For You

Axfon

About the Author: Axfon

Team committed to share our IT skills and experience through our website which may assist to formulate a task easy