If you’ve followed our blog, you may have noticed a couple different tutorials on how to setup a WordPress staging environment:
While both of these options work well, there is still a bit of manual work needed to push the website back out live to your visitors.
We’re now live with a new solution that will not only allow you to clone your WordPress website in 1 click, but it will also allow you to push out your changes when you’re ready with 1 click!
Why Do You Need A WordPress Staging Environment
If you’re wanting to make major changes to your WordPress website, such as a new theme, more plugins, or altered content it’s likely you want to do it in a staging environment so your visitors don’t see the website until you’re finished making changes.
When you go to make major changes sometimes things don’t always go as planned so you don’t want your audience to lose functionality of the website until you’re 100% ready to have the changes go live.
To solve this, you need to setup an exact replica (i.e. copy) of your WordPress installation so you can accomplish the work.
1 Click WordPress Staging
I’m very excited to announce that WordPress 1 click staging and 1 click push to live is now active on all NameHero web hosting, reseller hosting, and VPS hosting packages. This means all of our resellers can also offer this amazing feature to their end users (they’ll love it)!
To get started, you need to have your WordPress website active inside of the Softaculous apps installer.
If you installed your WordPress website using it (most of our customers do), then you’re all set. However, if you did a manual WordPress installation, or migrated over from another web host, you may need to add your WordPress website.
In order to accomplish this, I have another tutorial you should complete before proceeding:
Create The Staging Environment
Once you’re certain your WordPress installation is inside Softaculous, you can setup the staging environment.
To begin, you need to access the cPanel account where the WordPress installation is located.
For our web hosting customers, you can get here by going to the NameHero control panel -> Cloud Web Hosting -> Selecting Your Package -> Login To cPanel (under actions).
You can also access the cPanel for the specific domain by going to https://yourcooldomain.com/cpanel. Your username and password are the ones you used when you created the cPanel account (or in your NameHero welcome email).
Once you’re inside of cPanel, you want to scroll to the bottom and click on WordPress (under Softaculous Apps Installer):
This will bring you to a new screen where it lists your WordPress installations.
Beside the installation you want to setup staging (incase you have more than one) you want to click the ‘Create Staging’ icon under Options:
This will bring up a text-form that you need to fill out to tell the software where you want to stage your website:
In this example, I’m going to setup a staging environment for keydiets.com.
Live Installation URL: This is the link to your current active website
Choose Protocol: Most likely you want to use the same protocol of your live website (in my example https://).
Choose Domain: If you have an add-on or subdomain setup in your cPanel account for staging, you can select this here. For my example, I’m going to do it on my root domain but in a sub-folder.
In Directory: This is the directory to where the staging website will be created. In my case it’s going to be in https://keydiets.com/newwebsite
Database Name: The software is going to clone your existing WordPress database. You can leave this default or name is something that’s easy for you to spot.
Once you’ve filled out all this information you can click Create Staging and your WordPress website will be copied.
Check The Staging Website
Once the duplication has finished you’ll see a screen such as this:
It’s now a good idea to check these URLs to make sure the staging website is displaying without any errors.
If you notice an error 500 (or other server error) you’ll want to login to your file manager and view the error log. This file will be located inside the same directory where the staging site was created. Most of the time this is caused by a plugin that needs to be disabled or removed (you can add it back once the error is gone).
Complete Your Website Changes
Using the new URLs listed above, make the changes needed to your website.
Please remember, you have to make the changes in the staging wp-admin area.
All of the changes you’re making are not reflected on your main website.
It’s also important to note that any changes made on your live website won’t be included on the staging area.
That’s why it’s a good idea to complete the staging modifications when no one is posting and you may also want to temporarily disable user registers and comments (if you’re using these).
You can use the staging URL to view your changes in real time (in my example this would be https://keydiets.com/newwebsite).
Push Your Website Live
Once you’ve completed all your changes, you can then push the staging area to your live WordPress website.
To do this, you’ll want to follow the same steps listed above to access the Softaculous apps installer (cPanel -> WordPress).
You will now notice another installation in the menu:
Beside your staging website, you’ll notice the extra icon under Options. This is what you’ll want to click to begin to push it out live:
This will bring you to a screen where you have two options:
The default options will replace all the files of your live installation with the ones in Staging installation and will erase the live database and import the database from your staging installation.
If you’re good with that (what most will want to use) you can click the Push to Live button.
If you want to be a bit more specific about what you push to live, you can choose the Customize option.
Overwrite Files/Folders – This will overwrite all the files and folders in your current live installation. If you added a new theme, uploaded images, or added plugins, you’ll want to select this (most will).
Push Full Database – This is what the default option does. It pushes the complete staging database to your live website. For those that were unable/unwilling to stop all WordPress posting activity, comments, and/or user registrations, you won’t want to select this. This will allow you to retain that data.
Choose Database Changes – This displays the tables in the database that were altered during the staging state. You have the option to select or de-select those and actually merge those changes over to your existing database (very powerful feature).
Once you’re good with everything, you’ll then Push to Live.
Depending on the size of your WordPress website, this may take a couple of minutes to run. Please be patient and allow it time to complete.
Once finished, you’ll see a screen like this:
Congratulations, your website is now updated with the changes made in the staging environment!
You’ll want to inspect your website now and make sure you’re not getting errors. Some plugins added in the staging environment may create an error 500, so you may need to temporarily remove it and re-install it to get rid of the error. You can check this in the ERROR_LOG file within the directory where WordPress is located.
Delete The Staging Environment
Once you’re satisfied with all of your changes and are finished with the staging environment you’ll want to remove it from the server.
It’s a huge security risk to leave WordPress installations not used/updated on your web hosting account.
To do this, you’ll use the same instructions as above to return to the Current Installations screen and click the red X beside the staging environment:
This will bring you to a new screen that will confirm everything:
Once you’re certain you’re removing the staging environment (and not your live website) you can click the Remove Installation button.
You’re now finished and ready to go about your business!
How To Create A WordPress Staging Environment With 1 Click
I’ve filmed a video tutorial where I walk you through this entire process. Please note I start the video from the very beginning showing you how to select a NameHero package, install WordPress, as well as the features we offer.
If you’re already an active NameHero customer, feel free to skip ahead to the parts that pertain to your situation:
I hope you’re as excited as I am to have such a powerful feature live across our platform! Remember all NameHero customers have access to this!
Let us know if you have any questions!
Ryan Gray is the founder and CEO of NameHero, one of the fastest growing independent web hosts in the United States. Ryan has been working online since 1998 and has over two-decades experience in Internet Entrepreneurship.