Most people who develop websites are looking for easy and fast ways to launch their development environment. There are many 3rd party applications that allow for spinning up development environments with just a click of a button.
My favorite application to deploy WordPress development environments is a very popular piece of software known as, Local by Flywheel. The software is available for Windows and Mac operating systems. For each website, Local by Flywheel creates a docker container with a Nginx stack and MySQL installed by default.
You can download the free version of their software from their website here. Once you have installed the software, go ahead and launch it. You should be greeted with a nice step-by-step process to set up and deploy a local WordPress development site.
During the setup process for your new website, you can click on the advanced option and modify the domain you wish to use for this website. Typically, Local by Flywheel will choose a generated domain such as mysite.local. The software will then modify your computers hosts file to allow you to visit that domain in your web browser, and it will override any global DNS, allowing for you to load the website from your local computer, rather than a web hosting server. I like this feature because I can modify the domain to route to the domain that will actually be used for the website. For example, if I am developing a website for techgeeks.com, I can specify this domain as the domain to use, and it will route the .com to my local computer rather than using the DNS found on the internet. This is very useful when launching the website because if you use a temporary domain such as techgeeks.local, you will have to use a find/replace function on the database to replace all occurrences of techgeeks.local with techgeeks.com. I prefer to develop using the .com and when I’m reading to upload the website, I simply remove the hosts file entry that overrides global DNS.
Overall, I absolutely love using Local by Flywheel because I can spin up a new WordPress site in a matter of seconds.
If you have strong technical abilities, you may prefer to set up a LAMP stack or Nginx stack of your own, rather than using a deployment tool such as Local by Flywheel.
There are many great tutorials online for setting up your own local LAMP/Nginx stack. I usually refer to DigitalOcean’s documentation as a reference.
For more help with setting up a LAMP stack you can refer to the following guides:
After you have installed a local LAMP stack, you can modify your computers hosts file and route a domain/hostname to your local IP address.
If you are on Mac, you will use a Terminal to modify the /etc/hosts file using the command: sudo nano /etc/hosts .
On Windows, you will need to open the “C:\windows\system32\drivers\etc\hosts” file in Notepad.
You will insert the following lines:
This will allow you to load mysite.com in your web browser without actually registering the domain.
Once you have a LAMP stack installed and configured, you will want to create a new MySQL database and MySQL username. If you are unsure how to do this, you will want to use Google for more information.
Now you will want to download the latest version of WordPress and extract the source files to your document root. The document root path will depend on which LAMP stack configuration you are using, Once the source files are extracted, you can visit your website in your web browser and it should prompt you with an installation process.
No matter which way you choose to install WordPress, the results pay off. Developing a new website on a local machine is much faster and allows for you to finish the website and fully test it before launching.