WordPress Website with Google Cloud Platform‎

Author avatar wrote on 06/02/2019

WordPress Website with Google Cloud Platform‎

1. Create a new project 

    1. Go to Console
    2. Add new project
    3. Give a name then click create



2.
Install WordPress

  1. Select the new project
  2. Go to marketplace
  3. search for WordPress
  4. Pick WordPress Certified by Bitnami
  5. Lunch on Compute Engine

3.
Configure server

  1. Choose ram and size based on your website needs
  2. it’s ok to start with the minimu
  3. Boot Disk → choose SDD it’s much faster
  4. Deply
  5. Save WP IP address and login information on your PC

4.
Link your domain

  1. Click on API and Services
  2. Click on Enable APIs and Services
  3. Search for DNS
  4. Open Google Cloud DNS API and Enable it
  5. Console → Network Services → Cloud DNS
  6. Create zone, Host name is the domain name
  7. Add record Set

In
new tab open console → compute engine → get the external IP address

          1. Add record DNS Name empty

          2. Type: A,

          3. Add the external IP Address

8. Add Another record set

This
is for www

  1. Record DNS Name: www
  2. Type: CNAME
  3. Canonical name, the domain without www ex: domian.com

9. Add Google DNS Names to your domain registrar

10. Add these 4 domains provided by Google in the zone you created, it will be something like the for names below

      1. ns-cloud-d1.googledomainss.com
      2. ns-cloud-d2.googledomains.com
      3. ns-cloud-d3.googledomains.com
      4. ns-cloud-d4.googledomains.com

How to Reserve a Static IP
Address on Google Cloud Platform

It will save your website from being down whenever you restart the Apache server, or restart or stop your virtual machine.

  1. Go to VPC Networking → External IP Addresses
  2. Change type to static
  3. Add the name
  4. Click reserve

Moving The old content to the
new WP installation on GCP

On old Host

  1. Install the Plugin All-in-one migration
  2. Export the content to your desk

On WP on GCP

  1. Install the Plugin All-in-one migration
  2. Upload the exported file from the old server

Note: You might face a problem that the upload maximum size is 40MG and your
file is bigger

How to Increase Maximum
Upload File Size in WordPress

You can find the solution here:


help.servmask.com

There are 4 ways that you can choose to increase the maximum upload file size in WordPress

1. The Easiest is to use this plugin

Download it https://import.wp-migration.com/

On WP Panel → Add plugin → upload file → chose the downloaded file

2. Update .htaccess file

php_value upload_max_filesize 128M

php_value post_max_size 128M

php_value memory_limit 256M

php_value max_execution_time 300

php_value max_input_time 300

Change
the numbers to the values that you need. The max execution time and max input
time values are in seconds and might need to be increased further if your
internet connection is slow.

3. Update wp-config.php file

@ini_set( 'upload_max_filesize' , '128M' );

@ini_set( 'post_max_size', '128M');

@ini_set( 'memory_limit', '256M' );

@ini_set( 'max_execution_time', '300' );

@ini_set( 'max_input_time', '300' );

Google Cloud FTP Setup with FileZilla

4. Remove Bitnami banner on WordPress site

The
Bitnami info page provides information about the installed application
resources as well as useful links to documentation. It is accessible by
clicking in the Bitnami banner in the right bottom corner.

In
case you want to remove the banner, you will just need to SSH into your machine
and then execute the following command:

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

Please
note that /opt/bitnami is the default installation directory of the Bitnami
stack.

Finally,
you need to restart Apache.

sudo /opt/bitnami/ctlscript.sh restart apache

You
will find more information about the Bitnami banner using the following link:

docs.bitnami.com

stackoverflow.com