Setup a Development Environment for CentOS using cPanel

Editing a website’s code is often needed to update a site, but doing this to the live website could create downtime and other unwanted effects. Instead, its ideal to create an environment especially for developing new ideas.  In this tutorial, we will explore creating a development site specifically for CentOS servers.

As a warning, this is advanced technical work. It’s possible to make mistakes and cause downtime on your live domain. If you are not 100% confident, it may be a good idea to hire a system admin or developer to copy the domain for you.

Pre-flight

Step 1: Continue on to back up the cPanel account, just in case you have any issues while creating your development environment:

/scripts/pkgacct [username] --backup /home/temp/

Step 2: After creating a backup, you will create a copy the database of the main domain, otherwise known as the primary domain.

mysqldump [database_name] > /home/temp/backup.[database_name].sql

Step 3: Create the new dev domain in WHM. This domain name will be a subdomain of the primary domain. Creating a subdomain is one of the first steps in designing your development environment. We prefer to use, dev.[domain].com, the same domain name but with “dev” in front of it for clarity. Do be sure to note all the information, like the username and password. If you are not familiar with how to create a new account, see the following tutorial.

Step 4: Once you’ve created the subdomain within your cPanel you’ll copy the files from the main document root to the newly created dev document root. The document root is the location where your website’s files.

Use the following command to find the document root for either domain. Replace “exampledomain.com” with the primary and development domains for determining the location of document root for each.

whmapi1 domainuserdata domain=[exampledomain.com] | grep -i documentroot

Step 5: After locating the document roots we will copy the files from the primary domain over to the development environment. Insert the document roots into this next command.

rsync -avh /document/root/of/the/primary/domain/ /document/root/of/the/new/dev/domain

Step 6: Next you will need to state the correct ownership of the dev domain’s files and directories, as the previous username will be in place. The ‘dev_username’ will be the given/chosen when you created the new account. The following command will change the ownership for you.

chown -R [dev_username]: /home/[dev_username]

Step 7: After changing file ownership, create a new database and database user for the dev domain. Be sure to notate this information including the password set. Our documentation on the creating a new database will walk you through this necessary process.

Step 8: Once you’ve created the new database its user, you can start copying the original database into the newly created database.

mysql [new_database_name] < /home/temp/backup.[database_name].sql

Step 9: Copying over the database is the bulk of the work, but you’ll still need to edit the configuration files for your domain. Typically, some files need to access the database and will accomplish this via the database user and password. The file that contains these credentials needs to be updated to have the database, database user, and password you created in step 8 of this tutorial. If unsure of the location of these files talking with a developer may be helpful. If you are working with a WordPress site, you can continue onto the next section. Otherwise, if you have updated your dev configuration files with your new database info continue onto step 10.

Editing WordPress Configurations
Fortunately, WordPress is one of the most commonly used content management systems. WordPress is easy to configure we’ll provide a short tutorial on how to change the database and database user in the wp-config.php. First, move to the new document root. cd /document/root/to/the/dev/domain

There you will edit the wp-config.php with your favorite text editor such as vim or nano. nano wp-config.php

In the wp-config.php file, you will see a section that looks like the below. From there you will edit the highlighted characters with the information you used to create the database in the tutorial. // ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', 'new_database_name');
/** MySQL database username */
define('DB_USER', ‘new_database_user');
/** MySQL database password */
define('DB_PASSWORD', 'password');

In the database, clear all mentions of the original domain and replace them with the dev domain. For example with WordPress, in the _options table you need to change two entries of ‘home’ and ‘siteurl’. These can be quickly changed using WP-ClI, which is a is a command line tool for interacting with and managing WordPress sites. To install WP-CLI follow these instructions and continue onto the next step. If you do have a WordPress website, once you have installed WP-CLI you will want to run the following commands: su - [dev_username] cp public_html
wp option update siteurl https://dev.domain.com
wp option update home https://dev.domain.com
exit

Sometimes plugins or themes mention the original domain in the database. If some parts of the dev domain are not working, particularly plugins or themes, you may need to contact a developer to see if the original domain name is still active in the database. After replacing the names using WP-CLI, you’ll have officially created a dev domain.

Step 10: To complete this tutorial you have two choices: add an A record to your DNS view your dev site online or edit your local hosts file to view solely on your computer. For our Liquid Web customers feel free to contact The Most Helpful Humans™ with questions you may have in setting up a development environment.

 

 

Setup a Development Environment in Ubuntu

Often we want to edit our domain’s code, but on a production website, this can be dangerous. Making changes to the production site would not only allow all of the Internet to see unfinished changes but could also cause errors to display. As a workaround, we’ll create a testing domain or “dev” domain to work out any bugs and changes to the site.

As a warning, this is advanced technical work. It’s possible to make mistakes and cause downtime on your live domain. If you are not 100% confident, it may be a good idea to hire a system admin or developer to copy the domain for you.

Pre-flight

Step 1: After logging in as root, back up the domain using the command below to save a compressed version. It’s essential to have a copy of your site just in case you run into any issues. Replace the brackets and the “domainname” with your site’s name.

tar cfv backup.[domainname].tar /document/root/of/the/domain/

 

Step 2: We will be moving our backup file, .tar, somewhere off that document root, This way we can still access the data while keeping it safe.

mv backup.[domainname].tar /another/location/on/the/server

 

Step 3: The tar command created a file that comprises only half of the site, which holds the files. Next, you will want to copy the database for the primary site.

mysqldump [database_name] > /another/location/on/the/server/backup.[database_name].sql

 

Step 4: Create the new dev account, just like you were adding a new domain to your server. However, you will be creating a subdomain which you can name as dev.[domain].com.

 

Step 5: Once you’ve created the dev subdomain, copy the files from the main document root to the newly created dev document root. The document root is the location of the files housing your domain, also known as the “path”.

To find the document root location, for either domain, run the following command. Find the document root by replacing “exampledomain.com” for each both the live and dev domain.

conf=$(apache2ctl -S | grep exampledomain.com | perl -n -e '/\((\/.*)\:/ && print "$1\n"'); grep -i documentroot $conf

 

Step 6: After you have found the document roots for both the domain and dev domain, you will need to copy the files. With the output of the last command, you’ll insert the path for the document roots.

rsync -avh /document/root/of/the/domain/ /document/root/of/the/new/dev/domain

 

Step 7: Give the correct ownership to the dev domain, as the previous username remains in place. The ‘dev_username’ is a default user, one generated by creating the new account. The following command will change the ownership for you.

chown -R [dev_username]: /document/root/of/the/new/domain

 

Step 8: After you have done this you will need to create a new database and database user for the dev domain, be sure to keep all this information including the password you set. First, enter the mysql command prompt by running the command:

mysql

Next, create the database itself.

CREATE DATABASE [new_database_name];

In our next command, we create the user and their password. Be sure this is a unique username, unused up till now.

CREATE USER '[select_new_username]'@'localhost' IDENTIFIED BY '[password]';

 

Step 9: Grant privileges for the user on the database.

GRANT ALL PRIVILEGES ON [new_database_name] TO '[new_username]'@'localhost' WITH GRANT OPTION;

Then exit out of mysql by typing “quit” and hitting enter:

quit

 

Step 10: Once back at the root command prompt, you can start copying the original database into the new database.

mysqldump [new_database_name] < /home/temp/backup.[database_name].sql

With the database dumped you will still need to edit the configuration files for your domain. Typically, there are files which need to access the database and will reference the database, database user, and password. These credentials need updating to the ones created earlier in step 8 of this tutorial. If you are unsure of where these files contact a developer. If you are working with a WordPress site continue on to the next section.  Otherwise, if you have updated your dev configuration files with your new database info continue onto step 11.

Editing WordPress Configurations

Fortunately, WordPress is one of the most commonly used content management systems. WordPress is easy to configure we’ll provide a short tutorial on how to change the database and database user in the wp-config.php. First, move to the new document root.

cd /document/root/to/the/dev/domain

There you will edit the wp-config.php with your favorite text editor such as vim or nano.

nano wp-config.php

In the wp-config.php file, you will see a section that looks like the below. From there you will edit the highlighted characters with the information you used to create the database in the tutorial.

// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', 'new_database_name');
/** MySQL database username */
define('DB_USER', ‘new_database_user');
/** MySQL database password */
define('DB_PASSWORD', 'password');

In the database, clear all mentions of the original domain and replace them with the dev domain. For example with WordPress, in the _options table you need to change two entries of ‘home’ and ‘siteurl’. These can be quickly changed using WP-ClI, which is a is a command line tool for interacting with and managing WordPress sites.  To install WP-CLI follow these instructions and continue onto the next step.

If you do have a WordPress website, once you have installed WP-CLI you will want to run the following commands:

su - [dev_username] cp public_html
wp option update siteurl https://dev.domain.com
wp option update home https://dev.domain.com
exit

Sometimes plugins or themes mention the original domain in the database. If some parts of the dev domain are not working, particularly plugins or themes, you may need to contact a developer to see if the original domain name is still active in the database.

After replacing the names using WP-CLI, you’ll have officially created a dev domain.

Step 11: To complete this tutorial you have two choices: add an A record to your DNS to view your dev site online or edit your local hosts file to view solely on your computer. For our Liquid Web customers feel free to contact The Most Helpful Humans™ with questions you may have in setting up a development environment.

An Overview of Managed WordPress

WordPress is open source software for building unique and powerful websites! It is quickly becoming the easiest and most popular way to create blogs, business sites, portfolios, forums, memberships, and e-commerce websites.

Liquid Web’s Managed WordPress Hosting is a complete solution for your web publishing needs. With pre-installed plugins, streamlined plugin updates, website staging area, nightly backups, iThemes sync, and customizable website stencils, it’s a must-have for any WordPress developer.

 

MWP Features

Let’s get right into it with a couple of Managed WordPress Hosting best features and ease of use!

 

 

Pre-installed Plugins:

Managed WordPress (MWP) comes with quite a few money saving, pre-installed plugins, curated for maximum performance:

Akismet
Akismet: The number one plugin for spam filtering on blogs and forum pages.  This indispensable plugin helps comment-heavy sites by preventing spam comments from being posted to your site. Akismet protects your website from being marked negatively thus helping your Google SEO standing. A free plan is included with every site as well as having the option to subscribe to their Plus and Enterprise plans.
Async JavaScript
Async JavaScriptWith a 4.5-star rating by its users, Async JavaScript increases site speed and search engine ranking by only loading javascript viewable by the user.
Autoptimize
Autoptimize: If speed is essential to your site then you can’t go wrong with the Auto Optimizer plugin. Autoptimize takes out the legwork of site optimization by aggregating, minifying and caching scripts. For the CSS and JavaScript programmer, it can inject CSS into your page header, async non-aggregated JavaScript, and minimize HTML.
BJ Lazy Load
BJ Lazy Load: This plugin comes in handy for sites with lots of images. The idea is only to load those videos/pictures that are viewable on the browser and not those below the screen view (or “fold” as it’s called) until the client scrolls down the page. Thus increasing site speed and performance by reducing the resources loaded at a given time.
iThemes Sync
Themes Sync: Ever wish you had a portal where you could update all your plugins and themes for multiple websites in one spot? Look no further then iThemes Sync.  iThemes Sync provides you with one central dashboard for all your WordPress admin tasks saving you time to focus on development.
TinyPNG
TinyPNG: Minimizes load times for your site by compressing your images, while still maintaining photo resolution. Compression increases site performance especially if you have a large number of images.

WP Forms Lite
WP Forms Lite: Easily create contact forms with intuitive tools that allow for drag and drop construction.

Liquid Web’s Managed WordPress staging site allows you to experiment with themes, plugins, or any variety of other changes you might want to make, all without affecting your live site! It works by creating a temporary clone of your site to test your changes, giving you a chance to get things exactly the way you want them before applying them to your live site. So feel free to test away!

Nightly backups of your sites are included in each plan. The backups allow you to roll back to an older version by clicking the restore option, or you can download a copy. No need to install an extra plugin or stress when a development error occurs.

Core updates help secure your site from hackers and malware by keeping your website up to date. Once available, the core WordPress plugin updates MWP are tested before being implemented on your site. If the plugin or update is compatible with your site, it will auto push the update to the live site. If the new update is not compatible, it will let you know via email allowing you time to inspect at your leisure.

The stencil feature is useful for developers who use the same themes and plugins across multiple sites. You can create as many stencils as you like with the click of a button! Click here for information about how you can set up your stencil.

Managed WordPress allows you to access your content via SSH and FTP. Once logged into SSH, Liquid Web’s Manage WordPress comes with WP-CLI pre-installed, so you can make simple commands from the command line to fine-tune users, plugins, and current themes settings.

Let your users know their information is safe! Managed WordPress includes free SSL for all sites on your server to help keep your sites secure.  With automatic SSLs you no longer have to purchase certificates for your websites!

Our managed WordPress product has a 24/7 operations team that manages routine server maintenance and monitors for DDoS attacks, so you don’t have to, leaving you free to develop your website’s content.

Experience a streamlined way managing your sites through Liquid Web’s Managed WordPress platform.

 

Best Editor for Web Development 2017

Best Web Development Tools of 2017: Editors/IDEs and Package Management

The worlds of web hosting and web development are in a constant state of evolution. Every year we see design trends change, coding standards adapt and new frameworks/CMS created. With such a quick pace of change it’s easy to get lost trying to keep up.

In this article we will discuss and highlight a handful of tools that help make web development easy. Whether you work on Frontend, Backend, PHP, Javascript, or even Perl this list will have something helpful.

As a web hosting company we don’t often talk about the tools used to create the web. We’re usually ultra focused on the components that enable us to server and support you; things like: server hardware, Linux, Apache and etc.

We may not support development tools, but we do want to help our customers to build amazing stuff.
Continue reading “Best Editor for Web Development 2017”

Storm Private Cloud Parent

In addition to our dedicated servers, we also offer products on our cloud platform Storm on Demand. More information about the differences can be found here on our knowledge base in our Comparison article.

Working in a virtualized environment such as Storm on Demand does indeed give you a significant amount of control over your server, but you can now take that one step further: we have introduced an exciting new feature that allows you to create your very own Storm Cloud Parent.

You – and only you – will be allowed to add Storm instances to this private parent, and your parent will largely be separate from the public cloud.  This allows you to have even more control over the environment!  Your private Storm parent will be connected to the public network for certain features such as the Storm backup system and Server Images management.  The physical parent machine will control networking for your servers, but will be connected to the public network to utilize the Storm infrastructure.

Please note that this means that your backups and server images will be stored in an environment that is shared with (but not accessible to) other users.  Additionally, networking on the physical server is not shared, but the networking infrastructure between your private Storm Cloud parent and other Storm Cloud parents is considered a shared resource.

To get started, log into your Manage interface and press the “Create” button, like you normally would when creating a new server. You will see “Storm Private Cloud Parent” listed as one of the options. Select that box and then press yellow Configure New Device button to customize your parent. Continue reading “Storm Private Cloud Parent”