This article provides complete guide for hosting WordPress Multisite on Google cloud platform. Currently, two WordPress multisite stacks are available on Google cloud platform- one Certified by Bitnami and other Click to deploy. Although WordPress Multisite certified by Bitnami is better stack, this is complete guide for WordPress Multisite click to deploy hosting on google cloud platform. We will go through following steps for hosting reliable, safe and fully functional wordpress multisite websites.
Want to learn complete Web Development with certification? Enroll Now for Web Development Certification Training By Edureka and increase your chances to get hired by Top Tech Companies.
- Create Gmail Account
First of all, we need to create our google account (Gmail Account) because that Gmail will be required to sign up for Google Cloud Platform (GCP). We need Gmail for signing up with all the Google services. If you already have Gmail account, you may proceed to the next step. Create Gmail Account.
- Create Free Trial GCP Account
After creating your Gmail Account, head over to Google Cloud Platform (GCP). Sign up for your Free Trial GCP Account. On GCP website, Click Get Started for Free button and follow the Account creation steps on the screen. Enter all required Personal Information details and Billing Information to create your GCP Account. You need to provide your credit card information for setting up billing account and verifying payment transaction. Rest assured, Google does not charge your credit card ever without you entering in an agreement to do so for some service. After setting GCP Account up, you can use all the technology resources available on the platform.
- Deploy WordPress Multisite Instance
(i) Create Project
Sign in to your GCP Account with your Gmail. Then go to Console. Click on Project menu on top and create new project by giving Project Name you like. By default, a project by name My First Project is created.
(ii) Deploy WordPress Multisite
Then, click on the Hamburger icon (≡) on top left and click the menu Marketplace. Type WordPress on Search bar. Many WordPress solutions will be listed. Go to WordPress Multisite click to deploy. We can build a network of websites with this WordPress packages installation.
Click Launch button which will take you to New WordPress Multisite click to deploy Deployment screen. Fill up your Zone and Disk size details or you may go with the defaults. Then click Deploy button. Deployment will take a couple of minutes and you will see details of your WordPress Multisite instance deployment on the right side. You may check your deployment here or as described in next the step.
- Check your WordPress Multisite Deployment
(i) Visit your WordPress Installation by IP Address
Click on Hamburger icon (≡) on top left and select Deployment Manager. Select your WordPress Multisite Deployment. If you click on the Site Address URL, you will be redirected to the Sample page of your WordPress Multisite website. If you click on the Admin URL, you will be redirected to the WordPress Admin Login page. Here, fill up your Admin User ID and Admin Password from your Deployment details. Thereafter you will reach on Admin Dashboard of your WordPress multi-site. Here you will be building and making changes (edits) to your website(s) as Administrator, after all the following set up steps are complete.
(ii) Now set up multisite sub domains or sub directories (WordPress will provide you with options depending on your installation)
We will set up for sub domain scenario.
In the WordPress admin, go to Tools >Network Setup. You’ll be prompted to choose subdomains or subdirectories for your installation: choose the one that works for your network.
Edit the title of your network and email address of the network administrator when prompted, or leave them as they are.
Click the Install button. WordPress will provide two codes.
The final step is to copy these codes provided by WordPress into your wp-config.php and .htaccess files.
- Reserve static external IP Address
Now, Click on Hamburger icon (≡) on top left corner and select VPC Network >> External IP Addresses. Click on Reserve IP Address. Fill up all details and click Reserve. Here, change External IP Address Type from Ephemeral to Static. We do this because, when a stopped instance is started again, a new ephemeral external IP address is assigned to the instance, and we don’t want the IP Address to change each time our instance is restarted.
- Create and Configure DNS Zone for your WordPress Multisite Hosting
(i) Create DNS Zone
Click again on Hamburger icon (≡) on top left corner of GCP screen and select Networking >> Network Services >>Cloud DNS. Here, click on Create Zone button. Fill up Zone name (usually your website domain name, in lower case, eg. example) and DNS Name (your domain name address, eg. example.com). Select Zone Type Public and DNS Sec OFF. Click Create. DNS Zone will be created.
(ii) Now create “A” Record and “C” Record:
To create “A” record, click on Add Record Set. In DNS Name field, type subdomain name or leave blank, as is the case. You may type * to indicate any Sub-Domain. In Record Type field, choose ‘A’. In IPv4 field, type or paste External IP Address. Click Save.
To create “C” record, click on Add Record Set. In DNS Name field, type subdomain “www”. In Canonical Name field, type alias this www Sub-Domain refers to (website Address, e.g., example.com).
- Do Modification in DNS Zone of your Domain Name Provider/ Registrar
Log in to Domain Name Registrar’s website and go to DNS Records or DNS Zone. Here, either change Name servers to point to your hosting or add the ‘A’ record of your hosting.
(i) Change Name Servers
Add all four Name Server Records of your hosting (as provided in DNS Zone of your deployment at GCP, e.g., ns-cloud-d1.googledomains.com, ns-cloud-d2.googledomains.com, ns-cloud-d3.googledomains.com, ns-cloud-d4.googledomains.com) replacing the existing Name Server records. Save Records.
(ii) Add the “A record”
Click Add Records. Leave blank or type ‘@’ in ‘Host’ field (as specified by Domain Registrar). You may type ‘*’ to indicate any sub domain. Type or paste external IP Address of your hosting (deployment on GCP) in ‘DNS Name/ Points To/IP Address’ field, as the case may be.
8. Create Sub-Domains of your WordPress Multisite Network
WordPress Multisite is designed for subdomains, so it’s easy to add a separate blog (Website) for each subdomain of your primary domain. In this example, let’s assume we’re adding two blogs: hr.example.com and sales.example.com.
(i) Follow these steps to associate a new blog with a subdomain:
In the WordPress Multisite Admin dashboard, select the “My Sites >> Network Admin >> Sites” option.
Click “Add Site” to create the new blog or website. Fill up details and Save.
Repeat the above steps for all the subdomains and blogs you wish to create. Once you’re done, you can see a list by selecting the “My Sites >> Network Admin >> Sites” option.
(ii) Update DNS Records for all sub domains
At this point, you also need to update your domain’s DNS settings, specifically adding A records for your subdomains that point to the static IP address of your cloud server. Following these changes, entering the subdomain name into the browser address bar should take you to the blog (website) for that subdomain.
9. Commands for server configuration (Access SSH panel of you deployment for set up and configuration)
(i) Access wp-config.php file
Add the code provided in WordPress Admin to your wp-config.php file in /var/www/html/, just above “Stop editing happy publishing” and Save:
sudo nano /var/www/html/wp-config.php
(ii) Access .htaccess file
Add the code provided in WordPress Admin to your .htaccess file in /var/www/html/, replacing other WordPress rules and Save:
sudo nano /var/www/html/.htaccess
(iii) Access server Configuration Directory
sudo nano /etc/apache2/apache2.conf
(iv) Restart Apache server
sudo service apache2 restart
11. Install and activate Really Simple SSL WordPress Plugin to force ssl certificates on websites (How to install Really Simple SSL).
You may need to fix mixed content issue if you are using Elementor plugin on your website (How to fix mixed content issue in Elementor after moving to SSL).
12. Setup Mail SMTP
Setup Mail SMTP for the WordPress websites to be able to send Emails either with:
13. Final Words
Your WordPress Multisite is setup. Now Login as Administrator in WordPress eg. https://example.com/wp-admin/ . Go to Website Dashboard >> Settings and do required basic setup and save changes. Then, Install required Theme and Plugins and start building functional websites. All the Best. For any queries, please write to firstname.lastname@example.org.
One final step, you may improve the security and performance of your Website (s) by signing up (Free Signup available) at Cloudflare and adding your website at cloudflare.com.
You may be interested in How to host and set up WordPress Multisite certified by Bitnami on Google cloud platform.
That’s it! Keep editing and design stunning websites. All the best!