Setup WordPress on Windows Server in GCP using XAMPP
To setup a WordPress server in GCP, the easiest way is to install our WordPress Windows VM solutions from the GCP marketplace. Its the recommended way to deploy WordPress on Windows using MySQL server into Google GCP. Also comes preinstalled with phpMyadmin, MySQL, PHP and IIS. Click on the links below to deploy to your GCP project.
RDP into new WordPress Server
Once you have deployed our WordPress server, the first step is to RDP into the new instance once it has fully booted up. The following links explain how to connect the VM once it has finished being deployed:
Once logged in, you’re now ready to start setting up WordPress as per the getting started section next
Getting Started with WordPress on Windows in GCP
Once you’ve deployed the WordPress server to GCP you’re ready to start using it. The below sections explain how to use your new WordPress server and making any configuration changes.
Start XAMPP Control Panel
This solution uses XAMPP, making it easier to manage Apache, MySQL and FTP. Right click on XAMPP Control Panel on the desktop and choose Run as Administrator.
Once opened, click on start Apache and start MySQL
Setup MySQL Database for WordPress - phpMyAdmin
MySQL database credentials are (also used for phpMyadmin login):
In some instances password might be blank, if not try:
MYSQL Username: root
MYSQL Password: Password is the VM Instance ID. To find the Instance ID you will find on the property details of the VM within your GCP console. Here is a screenshot of where you will find it:
NOTE: If you find the root password doesn’t work. Wait 5 mins as during the first boot a start script is setting the root MySQL password and could still be running. You can see if its still running by viewing any Windows task schedule jobs. Wait for it to finish and then try logging in again.
WordPress files location:
C:\xampp\htdocs
Setting up WordPress
The first step is to create a MySQL database and MySQL user account that will be used to host WordPress.
Launch PhpMyadmin (http://localhost/phpmyadmin)
Login with:
Username: root
Password: Password is the VM Instance ID. To find the Instance ID you will find on the property details of the VM within your GCP console.
In some instances password might be blank.
NOTE: If you find the root password doesn’t work. Wait 5 mins as during the first boot a start script is setting the root MySQL password and could still be running. You can see if its still running by viewing any Windows task schedule jobs. Wait for it to finish and then try logging in again.
Click on the Databases Tab and enter a database name for the database you want to create and from the dropdown menu choose ‘utf8mb4_unicode_ci‘ as the DB collation as in the following screenshot:
Once you press ‘create’ the DB is now created. Next we need to create a user account and give it privileges on the newly created DB. Select the Privileges tab and select Add user account
Fill in a username and password and make sure ‘Native MySQL authentication‘ is selected under ‘Authentication Plugin’ from the drop down menu. Then select ‘Grant all privileges on database‘ and ‘Global privileges‘ Check all is selected and then press Go as per the screenshot:
Next we are ready to start the WordPress setup step. Open the desktop shortcut called localhost. It points to (http://localhost)
Choose your language and select continue. On the welcome page continue to the database setup screen pressing ‘Lets go’ and enter the newly created database and user details:
After hitting submit, on the next screen press ‘Run the installation‘.
Now enter your sites title, a username and your email address and press Install WordPress
And that should now be completed and you are now ready to use WordPress.
Access WordPress over the Internet
If you want to access the website externally. You will need to make sure your VM has a public IP address (External IP).
Within the WordPress directory
(C:\xampp\htdocs) –
Open the (wp-config.php) file and add the following lines towards the top
define(‘WP_HOME’,’http://Public-IP’);
define(‘WP_SITEURL’,’http://Public-IP’);
As shown in my example
Then restart ‘Apache’ – The service used by XAMPP Control Panel.
Also make sure any GCP firewalls have port 80/443 open to the internet.
If you want to access the website using a domain name, you’ll need to configure a CName record in your public DNS to point to the public IP address of your virtual machine hosting your WordPress website. You will be able to do this in your domain registrar where your domain name is hosted.
Within your domains registrar DNS settings, add new CName record
Under host add “@” and “www” the value it should point to the public IP address of your GCP virtual machine where your WordPress website is hosted.
Depending how quickly DNS propagates accross the internet, may take a few hours, you should be able to use your domain name to access your Google wordpress website.
Next is to update your (wp-config.php) file with your domain name settings as we did previously, instead of public ip.
Within the WordPress directory (C:\xampp\htdocs) – Open the (wp-config.php) file and add the following lines towards the top.
add your domain name as per the following example:
define(‘WP_HOME’,’http://www.domain.com’);
define(‘WP_SITEURL’,’http://www.domain.com’);
Then restart ‘Apache’ – via XAMPP Control Panel.
Also Read
Enable WordPress Single Sign On using WP Cloud SSO Plugin. Secure Your WordPress Logins
WordPress Firewall Ports
The Apache webserver uses the following ports:
TCP/80 – (http traffic)
TCP/443 – (https traffic)
Mysql uses the following port:
TCP/3306
To setup Google GCP firewall rules refer to – Creating GCP Firewalls
Support
If you have any questions about this WordPress deployment or are experiencing any issues with your deployment leave your comments below and i will answer them for you within 24 hours.
If you would like to hire us to setup your WordPress server for you, get in touch and we can get you up and running
.
Related Posts:
- How to Setup WordPress using XAMPP on Windows
- How to Setup WordPress Localhost Environment using XAMPP
- How to Setup XAMPP on Windows Server in Azure/AWS/GCP
- How to Create a Database on Windows Using XAMPP and MySQL
- How to Install XAMPP on Windows Server 2016 / 2019 / 2022
- XAMPP vs WAMP - What's the Difference (Pros and Cons)