https://upcity.com/wp-content/uploads/2018/04/local-wordpress-development.jpg [ad_1]
In addition to guest posting on the UpCity blog, Sunlight Media is featured as one of the Top Software Developers in the United States. Check out their profile here.
It’s conventional wisdom that using a local server for development has several benefits over using a live production server when working on any web project. Increases in workflow efficiency, as well as mitigating having to troubleshoot bugs on a live server are just two of the main benefits worth citing. That being said, there are more than a few different ways of setting up a local development environment, each with their own pros and cons. In this post, we’ll be taking a look at a new tool for WordPress development, Local by Flywheel. Combining many of the benefits of more complicated setups, Local offers a local development workflow that is both highly configurable and easy to use.
Local Development Today
For many years, the most common method for setting up a local development environment for the LAMP stack (Linux – Apache – MySQL – PHP) was to use MAMP (or XAMPP) as a local server. While this is generally a quick and easy method, it lacks many configuration options in order to exactly replicate a production server.
An ideal local development environment will exactly (or as closely as possible) replicate the same specs as the production server a website will ultimately end up on. This method will go a long way in mitigating any potential inconsistencies and incompatibilities with the local development environment and production servers.
To this end, many developers now choose to set up a local server using either Vagrant or Docker. Both of these methods utilize Oracle’s VirtualBox to run a virtualization of most any operating system. You can run a virtual machine of Windows, Linux, BSD as well as several other operating systems. In the case of a development environment, this is most often used to create a virtual Linux server with a configuration identical to that of the intended production server (i.e. the exact same version of Apache, MySQL, PHP, and any other applications needed to run the server correctly).
The main issue with this method is that it can be fairly involved and time-consuming to set up a development environment via Vagrant or Docker, especially for those not so well-versed with the command line. Local by Flywheel is an elegant solution to this problem for WordPress developers, offering almost all of the same configurability as Vagrant or Docker, all within a simple GUI application. Since Local is essentially a Docker container wrapped in a GUI, it offers virtually the same functionality as Docker, simply streamlined for WordPress development.
Getting Started With Local
The first step to getting started with Local is to download the installation via their official site:
(NOTE: Their site mentions both Free and Pro options, although as far as we can tell, the Free version is fully-featured for most applications)
After unzipping the application and moving it to to your Applications folder, Local will install and setup VirtualBox, if you don’t already have it installed on your computer.
Once the setup of VirtualBox is complete, click on “Create A New Site” to start your first WordPress project. It’ll ask you to create a name for your site, specify the local site domain (the URL you will access the local version of the site from), as well as the location for the site directory on your computer:
From there, you have the option of either choosing the “Preferred” configuration (PHP 7.1.7 + nginx + MySQL 5.6) or a “Custom” configuration. For now we will just select the Preferred option and come back to configuration options later:
Now select a username, password and email for the WordPress admin account. At this stage you also have the option of indicating whether or not this will be a WordPress multisite.
Then, just click “Add Site”:
In a matter of a few minutes, you will now have a new instance of WordPress set up with the specified configurations:
You can click on “Admin” to directly access the WordPress admin login page, as well as “View Site” to view your new WordPress installation:
Configuration Options
Local is packed with many configuration options and useful features for the WordPress developer.
If you’d prefer to set up a custom install of WordPress, you can select from 9 different versions of PHP, versions 5.5 or 5.6 of MySQL, as well as choose to run on either the Apache or nginx web servers:
Live URLs
One of the greatest features of Local is the ability to generate a public URL for your site. This is an actual URL that can be shared with clients or anyone you’d like to preview your site whilst in the development phase. No longer do you have to deploy your work to a server, get feedback, go back to your local development environment, etc. You can simply use this URL to preview a working version of the site until it’s time to finally time to deploy to the production server.
Simply click the “Enable” button next to Live Link for your Local Site, and a URL will be generated via ngrok.io:
One thing to note regarding the public ngrok URLs: they will only be active so long as both the Local application and site are running. This has one benefit in that it minimizes any potential site intrusions, making the site accessible only when you want it to be.
SSH Access
Another great feature of Local is being able to access the virtual server via ssh. You can do so by right clicking on the site in the left sidebar and select “Open Site SSH”. This will automatically ssh into the server, without need to supply root user credentials:
You can even specify the default command line application to be used, via preferences:
Conclusion
Local by Flywheel is a powerful tool for WordPress development that will rapidly speed up the workflow of creating any WordPress site. The configuration options and ability to create public URLs from your local version of a site are tremendously useful, creating solutions to problems that have no doubt caused headaches for more than a few developers. Considering the fully-featured application is totally free, Local by Flywheel is worth checking out for any WordPress developer looking to increase their efficiency.
mabc-shadow-none mabc-border-thin mabc-bckg-none" style=" ;">
No comments:
Post a Comment