We showed you how to dump media to Amazon S3 in a previous lesson. Today, we’ll go through a couple of methods for offloading media from your WordPress site to Google Cloud Storage, as well as serving your media directly from Google Cloud Storage or a CDN.
We are clearly great admirers of Google Cloud Platform’s technology and infrastructure because Gregghosting is powered by it. The primary motivation for doing so is to preserve disk space.
Google Cloud Storage is just a small part of Google Cloud Platform’s many products and services.
Google is able to offer relatively low storage charges because to its huge infrastructure and the fact that they deal with storage in bulk. A lot less expensive than a WordPress host.
Typically, this type of cloud storage is used for sites that require additional backups, such as those provided by our external backups add-on, or that serve up huge files (images, photos, downloads, software, videos, games). Spotify, Vimeo, Coca-Cola, Philips, Evernote, and Motorola are among their clients.
Contents e tablof ConteTnts
Google Cloud Storage vs Google Cloud CDN
Pricing for Google Cloud Storages
WordPress WP-Stateless and Google Cloud Storage Setup
WordPress WP Offload Media with Google Cloud Storages
Automatically shifting huge files to Google Cloud Storage can help you conserve space on your hard drive. 👍
CLICK HERE TO TWEET IMPORTANT INFORMATION
We offer a one-click disk space add-on for Gregghosting users who do not want to go through the process of setting up an external storage provider like Google Cloud Storage.
Google Cloud CDN vs. Google Cloud Storage
Google Cloud Storage is distinct from Google Cloud CDN or any other CDN provider. A content delivery network (CDN) is intended to speed up the delivery of your material, whereas Google Cloud Storage is intended to be used for bulk storage.
Google Cloud Storage, on the other hand, can help your site load faster because it use multi-regional storage. This implies that, similar to a CDN, your Google Cloud Storage material is stored and served from many locations within that region. It even makes use of the same edge cache system. It’s crucial to remember, however, that this isn’t a global solution and will most likely have more latency than a full-fledged CDN. You can choose from three regions when using Google Cloud Storages:
Asia and the Pacific
United States of America European Union
However, we’ll teach you how to use a CDN in conjunction with Google Cloud Storages further down.
Google Cloud Storage Pricing
For new clients, Google Cloud Platform offers a three-month, $300 free trial. You are eligible if you have never been a paying user of Google Cloud Platform and have not yet signed up for the free trial. This is a terrific opportunity to try out Google Cloud Storage and see if it’s perfect for your site before you commit to paying for it. See the Google Cloud Storages price and free trial FAQs.
A free trial of Google Cloud is available.
WP-Stateless with Google Cloud Storage for WordPress
The free WP-Stateless plugin, built by the excellent team over at Usability Dynamics, is your first option for connecting Google Cloud Storage with your WordPress site.
As files are added to the media library on your WordPress site, this plugin automatically uploads them to Google Cloud Storage. It then gives you options like backing up your material or even deleting your media from WordPress and serving it from Google Cloud Storage.
WP-Stateless is a WordPress plugin that removes the need for a database.
This plugin is still very young, however it has a good reputation and is often updated and maintained. It now has over 2,000 active installs and a 5 out of 5 star rating as of this writing. It also has official compatibility with the third-party plugins listed below:
Digital Downloads Made Simple
Image Optimizer by Imagify
Image Optimizer for ShortPixels
Advanced Custom Fields in WP Smush Addon for Image Cropping
Widget Bundle from SiteOrigin
CSS Gravity Forms by SiteOrigin
WPBakery Builder of Web Pages
It doesn’t mean a plugin won’t work with the integration if it isn’t included above. These are just plugins on which the UsabilityDynamics team has invested additional time in order to fix errors and ensure compatibility. However, new plugins like these should always be tested in a staging environment first.
You may get the free WP-Stateless plugin from the WordPress repository or by searching for it in the “Add New” plugins section of your WordPress dashboard. Activate it by clicking “Install Now.”
Install the WordPress plugin WP-Stateless.
Step 2: Install the WP-Stateless WordPress Plugin
Select “Begin Setup Assistant” from the drop-down menu. Alternatively, you can use their manual setup instructions.
Setup for WP-Stateless
Step 3 of the WP-Stateless setup
Select “Google Login” from the drop-down menu. You should log in with the Google Account you want to be linked to this website with and accept the permissions request. If you’re unsure about allowing access to your Google account, see their permissions request page. You can always use the manual setup approach if you don’t want to give your Google account access.
WP-Stateless Google Login (WP-Stateless Google Login)
Allow them to view and manage your data across Google Cloud Platform services by clicking “Allow.” Note that once a user has completed the login procedure, they do not keep any tokens or access credentials.
Request for Google account permissions
Step 5: Request Google account permissions
WP-Stateless will then assist you in setting up your Google Cloud project and bucket where your WordPress media assets will be stored.
A Google Cloud Project is a container for each Google Cloud Bucket. You have the option of starting a new project or selecting one of your existing ones.
Google Cloud Bucket: A bucket holds all of your WordPress data. You have the option of creating a new bucket or selecting one of your existing buckets.
Multi-Regional Storage Class in Google Cloud Bucket: Your newly created bucket will be provisioned with a multi-regional storage class. Choose the region where the majority of your website’s visitors are located.
If you don’t already have a billing account with Google, click the button to create one. Remember that they offer a three-month, $300 free trial.
Important: If you wish to utilize Google Cloud Storage with your own custom domain or CDN URL, make sure your bucket has the same name as your CDN domain URL. gcs.yourdomain.com is the name of the bucket. It will warn you about characters, but periods in bucket names are OK. It only has to have an alphanumeric character at the beginning and finish.
Bucket and WP-Stateless Project
Click “Continue” once you’ve finished configuring everything above. After that, you should see a confirmation that everything is in order.
Now is the time to subscribe.
Setup for WP-Stateless
In the WP-Stateless Plugin’s Google Cloud Storage Settings, WP-Stateless configures Google Cloud Storages.
Under “Media Stateless Settings,” you’ll discover the WP-Stateless and Google Cloud Storages options. You’ll want to configure the mode you desire under the “Settings” tab.
Disabled: Stateless Media is disabled.
Backup and serve local file URLs by uploading media files to Google Storage.
Copy media files to Google Storage and serve them directly from there using a content delivery network (CDN). You can’t utilize Gregghosting CDN and this option at the same time. Either one or the other must be chosen.
Stateless: Only use Google Cloud Storage to store and serve media files. Local storage of media files is not possible. This option will save you the most space on your hard drive.
Replace the URL of the file: During the presentation, it scans the post content and meta and replaces local media file URLs with Google Cloud Storage URLs. This option has no effect on your database.
WP-Stateless mode is a stateless option for WordPress.
Worried about losing your media files in the future? Don’t worry, the plugin features a sync feature (which we’ll go over in more detail below) in case you wish to go back to the previous state. You can also get your WordPress upload folders from your Google Cloud Storage bucket, which is designed to look just like your media library (as seen below).
Google Cloud Storage is a service provided by Google. Bucket folders in WordPress
Additional options can be found further down the page:
Cache-Control: This is set to public, max-age=36000, and must-revalidate by default. If you desire, you can override this.
GSC File Delete: If you want the file to be destroyed from GSC when you delete it from your WordPress media library, check this box.
URL and Domain of the File: Your own custom domain should be used instead of the default GCS domain. You’ll need to set up a CNAME for this. Please note that the bucket name and domain name must be identical. HTTPS is not supported with a custom domain, according to their literature, yet it worked perfectly for us.
Organization: Organize your uploads into folders based on the year and month.
Cache Busting: Prefixes the filename with a random set of numbers and letters. When uploading files with the same filename, this is useful for avoiding caching issues.
Additional WP-Stateless options
Your images are automatically copied to Google Cloud Storage when you add them to your WordPress media library. However, you’ll want to execute a bulk sync after you’ve configured the plugin. The following settings are available under “Media Stateless Settings Sync”:
WordPress Google Cloud Storage Setup with WP Offload Media
Sync Google Storage with the local server and regenerate all stateless pictures. (Note: the first time you use this option, it will take some time.)
Non-image files should be synchronized between Google Storage and the local server.
Non-media library files should be synchronized between Google Storage and the local server.
WP Offload Media and WordPress Google Cloud Storage Setup
The free WP Offload Media Lite plugin (or premium WP Offload Media) from Delicious Brains Inc. is your second option for connecting Google Cloud Storage with your WordPress site.
Do you have issues with downtime with WordPress? GreggHosting is a web hosting service that saves you time! Take a look at our highlights.
WP Offload Media is a WordPress plugin that allows you to offload media from your site.
The basic edition of WP Offload Media will certainly fulfill most of your needs; however, upgrading to the premium version adds several useful features:
Email support from PriorityExpertTM.
Upload your existing Media Library to the cloud.
From the Media Library, you may manage your cloud storage files.
Once files have been offloaded in the background, remove them from the server.
Download the file and delete it from the cloud storage.
In the background, copy files across buckets on your storage provider.
With the Assets Pull Addon, you may serve site assets (CSS, JS, pictures, fonts, and more) from CloudFront or another CDN in just a few clicks.
WooCommerce, WPML, Easy Digital Downloads, Meta Slider, Enable Media Replace, and Advanced Custom Fields all have integrations.
You may get the free WP Offload Media Lite plugin from the WordPress repository or by searching for “WP Offload Media Lite” in the “Add New” plugins section of your WordPress dashboard. Activate it by clicking “Install Now.”
Install the WordPress plugin WP Offload Lite.
Step 2: Install the WP Offload Lite WordPress plugin.
For Google Cloud Storage, follow these quickstart instructions:
Go to the Google Cloud Platform (GCP) Console and sign in.
For GCS, create a Service Account Key File.
Details of the Service Account Key File are being saved.
WP Offload Media License Activation
WP Offload Media Offload Your Existing Media Library Configure WP Offload Media Offload Your Existing Media Library
Google Cloud Storage CDN Integration
Concerned about Google Cloud Storage’s performance? True, multi-regional storage isn’t as quick as a traditional CDN, and it’s certainly not ideal for global users. You can still use your favorite CDN provider to send files. A few distinct alternatives are listed below.
Use KeyCDN to set up WP-Stateless.
Simply execute the procedures outlined below, using KeyCDN as an example.
Important: Because you’ll be billed by both Google Cloud Storage and your CDN provider, you’ll want to conduct some math ahead of time. This is also a wonderful approach to estimate your costs without being billed by Google if you’re utilizing the Google Cloud Platform trial. The following does not work with Gregghosting CDN at this time.
Create a new zone dedicated to your Google Cloud Storage files. Use KeyCDN’s Google Cloud Storage CDN integration tutorial. In essence, Google Cloud Storage serves as your origin server.
On the new zone, install Let’s Encrypt for HTTPS.
At KeyCDN, create a new zone alias. gcs.yourdomain.com is an example.
In the WP-Stateless plugin settings, use your zone alias.
As a result, all of your Google Cloud Storage files are now delivered via KeyCDN. The issue with performance has been resolved!
KeyCDN and Google Cloud Storage
Because the WP-Stateless plugin only manages your media library (images), you’ll probably want to use a CDN to deliver your scripts (JS, CSS). Simply follow the instructions outlined below to get started.
Set up a second CDN zone for your assets with your CDN provider, and use a different URL from the one above, such as cdn.yourdomain.com.
Install a CDN plugin for WordPress that allows for exclusions, such as CDN Enabler (free), Perfmatters (paid), or WP Rocket (premium).
Create exclusions so that your CDN plugin only loads CSS, JS, and other related files. The WP-Stateless plugin will take care of your media files, while the CDN plugin will take care of your assets.
Perfmatters excludes CDNs.
As a result, your assets load from your other custom CDN URL, while your media loads from your custom CDN URL (which is taken from Google Cloud Storage). Additionally, if you run your WordPress site in “Stateless” mode, your photographs will not take up any disk space. It’s really cool!
A combination of Google Cloud Storage and CDN
Configure Google Cloud CDN with WP Offload Media
When serving offloaded material, WP Offload Media is set to use raw Google Cloud Storage URLs by default. It’s possible that your media URLs will look like this:
See how to set up a custom domain CDN for Google Cloud Storage in their tutorial.
Save time, money, and improve site performance by using:
Expert WordPress hosting assistance is available 24 hours a day, 7 days a week.
Integration with Cloudflare Enterprise.
With 29 data centers across the world, we can reach a global audience.
With our built-in Application Performance Monitoring, you can improve your performance.
All of this and more is included in a single plan that includes no long-term obligations, aided migrations, and a 30-day money-back guarantee. Check out our plans or speak with a sales representative to find the ideal plan for you.