
Migrating to Google Cloud Platform cPanel can be a complex process, but it doesn't have to be overwhelming. You can start by assessing your current hosting infrastructure, including the number of servers, storage, and bandwidth requirements.
Google Cloud Platform cPanel migration involves several steps, including setting up a new cPanel account, migrating files and databases, and configuring DNS settings. The process can take several hours or even days, depending on the size of your infrastructure.
To ensure a smooth migration, it's essential to plan ahead and test your setup before making any changes to your live environment. This will help you identify and resolve any potential issues before they cause problems.
Google Cloud Platform offers a range of tools and resources to help with cPanel migration, including the Cloud Console and the cPanel Migration Tool.
Setup and Configuration
To set up Cpanel backups, configure the Cpanel backups to use the mounted Google Drive. Give it a name and select the box that says transfer system backups to destination.
You'll also need to decide whether to leave the backups on the local drive for quick restores. If you have the space, feel free to do that by clicking Retain backups in the default backup directory.
To set up Cloud DNS, create a DNS Zone and then create one additional A record for the Cpanel subdomain in your Cloud DNS. Click Add record set, select Resource Record Type to "A", and enter the IPv4 Address with the IP address of your instance that you have reserved earlier.
Configure Registrar Hosted DNS Zone
To configure your registrar hosted DNS zone, you need to create a CNAME record for your domain to point to c.storage.googleapis.com.
Create a CNAME at the registrar DNS zone for your domain, specifying the hostname as www.yourdomain.com and record type as CNAME, with the address set to c.storage.googleapis.com.
The setup also requires a URL redirect for the root domain, and adding a TXT record for domain ownership verification.
Note that the www host CNAME and URL Redirect are necessary for your domain to resolve via www.yourdomain.com and yourdomain.com.
Configure Custom Pages
You'll want to set your main page and 404 page to ensure a smooth user experience. This includes setting your index page file and what's served when someone reaches the domain name.
The gsutil web set command is essential for this, as without it, you'll only get an XML file when accessing the domain.
You'll also set a 404 page for when a page is not found, which is crucial for user navigation and search engine optimization.
One Answer
To troubleshoot network issues, first check that you've created the required firewall rules in Google Cloud Platform. Refer to the documentation for guidance on how to do it.
Verify the firewall rules inside your instance using commands like `iptables -L` and `firewall-cmd --get-active-zones` and `firewall-cmd --info-zone={activezone}`.
If you're trying to access port 2087 and it's not open, you might not be able to telnet either. To debug network issues, consider using tools like `iftop`, `iptraf-ng`, and `tcpdump`.
If you have SELinux in enforcing mode, make sure that the cPanel files are in the correct context.
Account and Credentials
To set up a Google Cloud Platform cPanel, you'll first need to create a Service Account, which is essentially an access key that allows a user to log in to Google Storage.
You'll find the Credentials page in the Google console, where you can create a new Service Account key by clicking on the "Create credentials" button and then selecting "Service account key".
Give the service account a name and choose the Storage Admin role, which is the most obvious choice for this purpose.
Leave the key type as JSON, as it's the recommended format.
Once you click Create, a JSON key file will be downloaded to your local PC, which you'll need to transfer to the cPanel server you want to back up.
This JSON key file is essential for authenticating your cPanel server with Google Storage, so be sure to keep it safe.
Infrastructure and Deployment
To set up your destination server on Google Cloud, you'll want to use a pre-configured image from the marketplace, such as the LAMP stack Google click to deploy image. This will save you time and ensure everything is ready to go.
The httpd root directory is located at /var/www/html/ in the Debian image, so you'll need to copy your files there.
For a low-traffic PHP site, hosting the web server and MySQL server on a Compute Engine instance is a cost-effective option. You can also consider hosting the DB on other services like Cloud SQL, but that's not the focus here.
To create a VM instance, choose a machine type with 3.75 GB memory and 1 vCPU. Then, select CentOS 7 as the boot disk and ensure it's at least 40 GB in size.
Setup Bucket
To set up a bucket, head to the Google Storage screen and click Create Bucket. You'll need to come up with a unique name for your bucket, which doesn't really matter, just that it's distinct from other buckets.
The name you choose will determine whether you get a message saying someone else has already picked it. So choose wisely.
For the region selection, Google's choice is a bit more obvious than Amazon's.
Configure Cpanel Backups to Use Mounted Drive
To configure Cpanel backups to use a mounted drive, you'll need to give it a name and select the box that says transfer system backups to destination.
It's worth noting that you should only do this if your connection is encrypted, although it's unclear if this connection is indeed encrypted.
You can choose to leave the backups on the local drive for quick restores, but you'll need to have the space for it.
DNS Configuration
To set up a DNS zone, you need to create an additional A record for the cpanel subdomain in your Cloud DNS.
You'll need to click Add record set, select Resource Record Type to "A", and enter the IPv4 Address with the IP address of your instance.
In Google Cloud, the standard email port is blocked, so you'll need to configure a third-party email service provider like Mailgun to send emails.
To use Mailgun, you'll need to create two DNS records: an A record pointing to mail.domain.com and an MX record with 0 priority pointing to mail.domain.com.
You'll also need to update your domain's DNS zone to point to Cloud Storage by creating a CNAME record at your registrar's DNS zone.
This CNAME record should point to c.storage.googleapis.com, and you'll also need to set up a URL redirect for your root domain.
Cloud DNS costs around $0.21 per zone, so if you're already using a DNS zone, it might be worth pointing your domain name to Cloud DNS and setting up the zone to point to your Compute Engine instance via an A record.
Google Compute Engine won't preserve the hostname you set, so make sure to follow the steps to preserve the hostname and prevent a locked cPanel & WHM license.
Create VM
To create a VM instance, start by choosing a machine type with 3.75 GB of memory and 1 vCPU.
You'll then need to select CentOS 7 as the boot disk and enter a size of at least 40 GB.
If you have a valid license, you can reserve your IP address by going to VPC Networks and External IP Addresses, then selecting Reserve static.
Setup Destination Server
To set up your destination server, you'll want to start by choosing a reliable image. I recommend using the LAMP stack Google click to deploy image, as it comes pre-configured with everything you need.
This image can be found in the Google Cloud Marketplace, where you can trust its authenticity. You can then use it to create a Compute Engine instance, which will serve as the foundation for your migrated server.
The httpd root directory in this Debian image is located at /var/www/html/, so make sure to copy your files there accordingly. This will ensure a smooth transition to your new server.
G SDK Installed
The Google Cloud SDK requires Python 2.7 or 3+ to be installed on your server.
You'll need to install Python 2.7 if your server has an outdated version like 2.6, which is what happened with my cPanel server.
To fix this, you can install Python 2.7 by running the command "Install python27".
If you're still having issues, you might need to install sqlite and recompile Python 2.7.
After installing Python 2.7, you'll need to set an environment variable to let the Google Cloud SDK know where Python 2.7 is located, which in my case was /usr/local/bin.
Once you've fixed these issues, you should be able to successfully authenticate with the Google Cloud SDK and select the project you want to use for your migration.
Cost Comparison
The cost of running a VPS with cPanel can add up quickly, as the user in the article experienced, paying around $58/month for just a few websites.
Linode costs $38.50/month, but adding extra features like an Additional IPv4 Address and Backup Service pushed the cost to $38.50 + $1.00 + $7.50 = $47.00/month.
The user opted not to renew their cPanel license, which was $20/month for 5 domains, further reducing costs.
Running 2 migrated cPanel sites on GCP cost $21.67/month, with the bulk of the expense being instance fees and static IP charges.
The user notes that powering down one of the instances earlier this year reduced their expense to around $45/month.
Google Cloud Storage offers extremely low-cost hosting for sites that don't require a DB or much web server configuration, making it a cost-effective option for individual users.
Frequently Asked Questions
Does cloud hosting have a cPanel?
Cloud hosting typically does not include cPanel by default, but some providers may offer it as an optional feature. Check with your provider to see if cPanel is available for your cloud hosting plan.
Can I host my website on Google Cloud?
Yes, you can host your website on Google Cloud with our free trial, which includes a range of products to choose from. Get started with our step-by-step guide and technical article for more information.
Sources
- https://storageswiss.com/2017/04/21/backup-cpanel-website-to-google-cloud-storage/
- https://www.cloudbooklet.com/developer/installing-cpanel-whm-on-google-compute-engine
- https://medium.com/google-cloud/migrating-a-cpanel-web-hosting-server-to-google-cloud-acdcf7c95768
- https://stackoverflow.com/questions/54389928/cpanel-and-whm-both-not-opening-on-google-cloud-vm-instance
- https://stackoverflow.com/questions/39566826/cpanel-not-opening-in-google-cloud-whm-is-working-fine
Featured Images: pexels.com