HanG321 Blog

升級/轉移 WordPress in GCP marketplace

舊年係GCP用”WordPress Certified by Bitnami”,原來佢地個個Base Image 係Debian 8. 上兩個月收到通知要更新,今個weekend趁住有時間順便一次過upgrade。今次會試下”Nginx WordPress with NGINX and SSL Certified by Bitnami“,睇下用Nginx會唔會快過Apache。

1. New VM

首先登入GCP,左上角Menu > MarketPlace,然後搜尋 WordPress,再揀Nginx WordPress with NGINX and SSL Certified by Bitnami,按Launch on Compute Engine button。

因為Free Tier 嘅關係,記住要揀係美國嘅region,同 f1-micro instance. Disk size 30GB 以下就得, 我自己用15GB. info: https://cloud.google.com/compute/pricing#freeusage

2. Backup

等緊個VM create嘅時候,可以就係用緊嘅WordPress 做 Backup。Install “All-in-One WP Migration” plugin, Export everything. 詳細資料:https://docs.bitnami.com/aws/how-to/migrate-wordpress/,Backup 完然後power off

3. Migrate

個新VM 起好之後,In VPC network > External IP address,這個舊嘅static IP 轉去新 VM 到,然後ssh to new VM, restart all services

再登入新WordPress,check 返site setting同user email address ,如果係 IP address 就改番做Domain name。

終於係時候Import返 data: All-in-One WP Migration > Import,upload the backup file.

Disable bitnami logo:

搞掂。

當一切安好之後,就可以Delete 舊VM & snapshot。

 

(Optional 1)

用Let’s encrypt & Cloudflare SSL strict mode:
一直用開 Cloudflare 免費CDN & FleixSSL,而家用 Lets encrtpy 其實可以唔使用 Cloudflare SSL, 不過費事大搞, 轉做strict mode 算.

in ssh shell:

我揀左 Yes 但係個crontab 都係冇野,要手動加返上去。

 

(Optional 2)

redirect HTTP to HTTPS in nginx

如果唔用 Cloudflare redirect,可以係Nginx 做,改 server_name 同埋加 301 :

 

 

Reference: