Skip navigation
Tyssen Design — Brisbane Freelance Web Developer
(07) 3300 3303

Using Local by Flywheel with other CMSs

By John Faulds /

Haven't heard of Local by Flywheel? It's a web development tool for managing server environments that was designed to be used with Wordpress, but can easily be used for Craft, ExpressionEngine, Processwire or any Content Management System (CMS).

So why should you use it? In my case, I've been using MAMP Pro for a long time but have been finding that any sites running on it are very slow. I'm not sure whether that's a problem with the app itself or it could just be my own individual set-up. But I also find that it crashes quite often, which isn't harmful, it doesn't do anything to my local sites, but it is inconvenient having to restart it more than once when making changes.

So a while back I went looking for alternatives and I came across Local by Flywheel.

The Local website

Local is powered by Docker which means your local environment can exactly match that of your live server. It's easy to switch between NGINX and Apache, and change versions of PHP and MySQL. Creating local SSL support is also simple. And it's got a nice, friendly interface to guide you through the process too.

I'm still running MAMP because I have a lot of older sites set up with it that I haven't bothered to set up again with Local (yet) but I'm finding the sites running on Local to be more responsive, less laggy, than the ones running on MAMP.

So enough of the sales pitch, Local is great, how do we go about it?

The walkthrough

Install Wordpress

After you've installed Local, you'll be ready to create your first site. You'll start by giving it a name, domain and specifying the location (it can be anywhere on your computer you like).

Step 1 of the Local set up

You'll notice the dropdown that says Create site from Blueprint?; at the end of the process when you've set up your site and have everything just the way you want it, and would want to use the exact same set-up for other sites, you'll be able to save it as a blueprint and will be able to skip some of the steps that are to follow. A blueprint is essentially a boilerplate but it will also include the database of the site you're setting up, so it will be worthwhile logging into the CMS once you're done copying and moving files and performing whatever default set up tasks you normally carry out so that these can all be easily duplicated when you're creating new sites from the blueprint.

Next you'll choose set up the environment and you can choose either the preferred Local environment, or you can set up your own custom one, choosing from different versions of PHP and MySQL and either Apache or NGINX.

Step 2 – choose the preferred environment
Or choose your own

The last step asks you to set up Wordpress which is basically just creating an admin user. After Local has finished installing Wordpress you're going to remove all the files and the tables from the database but keep the database itself, so it doesn't really matter what you specify here.

Step 3 – set up Wordpress

When Local has finished installing Wordpress, you should see something like this:

The Local Sites dashboard

Clicking through the other tabs

  • you can see all the information you need for connecting to the database with buttons which will open the database in either Sequel Pro or Adminer (not sure if it's possible to configure Local to work with other database management apps)
  • there's a button to create a local SSL certificate
  • and under Utilities there's a button to open MailHog which I haven't actually gotten around to using yet
The database tab
What you'll see in Sequel Pro immediately after installation
The SSL tab
The utilities tab
Clicking the Mailhog button will open this in your browser

After installation is complete, your directory structure will look like this:

Default Local directory structure

Before moving on, you'll notice that the public folder is called public, but you can rename it to anything you like to mirror your production server. To do that, you'll need to edit the 000-default.conf file which you can find in the /conf/sites-enabled folder. Before editing the file, stop the site in Local and then restart it again afterwards.


<VirtualHost *:80>
	ServerAdmin webmaster@localhost
	DocumentRoot /app/public

	ErrorLog ${APACHE_LOG_DIR}/error.log
	CustomLog ${APACHE_LOG_DIR}/access.log combined

   	<Directory /app/public/>
       Options Indexes FollowSymLinks ExecCGI
       AllowOverride All
       Require all granted
   </Directory>
				
To change the name of your server's public folder, edit the lines that say /app/public

Remove Wordpress and install your own CMS

At the completion of the Local installation process, you'll have a default Wordpress site working. If you do Wordpress development, then you can stop reading here.

If you want to use Local with a different CMS, then your next steps will be:

  1. remove all the Wordpress files from the public folder
  2. remove all the tables from the database
  3. copy the files from your chosen CMS into the public folder
  4. run the installer for the new CMS, or if you've already got a boilerplate instance working elsewhere, you could just import the database

I always like to refresh my boilerplates periodically so running a fresh install and reviewing all the default settings you usually establish might be a good idea now.

If you're already happy with the boilerplate you have, copy all the files and import the database and you're done… nearly. There's one more thing you can do to make the process quicker and simpler in the future.

Create a blueprint

A blueprint is essentially Local's own form of boilerplate. To create one, you right click on the name of the site in the list and then choose Save as blueprint. The next time you create a site, at the first step you'll be able to choose a blueprint which means you won't need to do any file deletion or copying or importing of databases, the new site will be an exact copy of the state of the site at the point you saved the blueprint.

The only small problem with blueprints is that you can't update them, you have to delete and then save a new one.

And that's it! That's all there is to it. You can now get on to the most important, the actual development of the site.