WordPress MultiSite (formerly known as “WordPress-MU”) is a built-in feature of WordPress that allows you to securely host many WordPress sites on the same code and database. It was developed for WordPress.com, one of the highest traffic web sites in the world.
By using these two tools together, we can compose powerful new site networks catering to different verticals and communities around the world.
TL/DR: Head to this github repo and follow the instructions in the README for a fluid, MultiSite-capable development environment with no dependencies outside of Docker.
Why should MultiSite matter to you? Let’s imagine you spot a business opportunity providing tailored websites to a particular vertical – Research Institutes in Brazil, for example. With WordPress MultiSite you could create a SaaS business called “researchsites.br”, based on a customized WordPress installation specialized to that market.
WordPress provides a robust and well-documented core, and you just add the billing, custom themes & plugins, physical or cloud infrastructure, and whatever support your customers need.
Since joining Automattic two weeks ago, I’ve been on a quest to create the perfect WordPress development setup, but my previous efforts didn’t work with MultiSite because PHP’s built-in web server has no URL Rewrite support. That’s why this week I’m updating my Docker image to use Nginx + PHP-FPM, so I can design my first Blog Network, climateblog.org.
Firstly – the same caveat as last time – this image is definitely not for production use! The only way to share files with your desktop using Docker volumes is to run the server processes as the root user.
For production, use either the official WordPress Docker image or deploy on a standard WordPress-compatible web hosting environment like Dreamhost or Hostgator. Or, if you really want unlimited scale, on WordPress VIP!
How the image is built
The most important way in which the image has changed from the previous iteration is swapping out PHP’s built-in web server for Nginx and PHP-FPM (FastCGI Process Manager). This combo – unlike Apache – can be run as the root user, allowing the Docker container and local development machine to both write to the same filesystem.
For nginx, we changed the line “
user www-data” to “
user root” in
For PHP-FPM, I changed the
listen.owner values to be “root”.
Another major change was adopting supervisord as the main process, so that we can run both nginx and PHP-FPM on the same container. Docker containers don’t “boot” like a regular VM, therefore process orchestration must be done by hand rather than relying on
How to use it
To get up and running, check out this github repo with a sample configuration file, then follow the instructions in the README.
Once you’ve done that, you can enable MultiSite like this:
docker-wp core multisite-convert --title="My Blog Network"
Then in a shell run
open "http://$(boot2docker ip):8080/wp-admin/network" to configure the site network, or continue to use the awesome wp-cli to make changes.