Skip to content
This repository has been archived by the owner on Nov 23, 2021. It is now read-only.

How to create a multisite network

Carl Alexander edited this page Oct 5, 2016 · 5 revisions

Contents

  1. A note about creating a multisite network
  2. Configuring a site as a multisite network
  3. Configuring a multisite network to use subdomains
  4. Configuring the server

How to create a multisite network

Multisite network is a powerful WordPress feature. It lets you manage multiple blogs from a single WordPress installation. This guide will help you create a multisite network using DebOps.

It'll show you how to do it when creating a new WordPress site (ideal) or converting one to multisite. You'll also see how to configure your multisite network to use subdirectories or subdomains.

This guide assumes that you're familiar with how to customize your server. If you don't know how or aren't sure, take a moment to go over this guide first.

A note about creating a multisite network

DebOps cannot convert an existing WordPress site into a multisite network. If you wish to do that, you need to first convert your existing site using the instructions from the Codex. Once you have converted your site, you should proceed with the rest of this guide.

You will need to update the vars.yml file of your site. It'll need to match the configuration of the network you created. That way DebOps can configure the rest of your server to work with your converted WordPress site. Otherwise, you might run into issues.

Configuring a site as a multisite network

Configuring your WordPress site as a multisite network is quite simple. You just need to tell DebOps to create the site as a multisite network instead of a single WordPress site.

# inventory/host_vars/wordpress.example.com/vars.yml

wordpress__multisite: True

wordpress__multisite determines if DebOps will configure the site as a multisite network or not. By default, DebOps will configure the multisite network to use subdirectories. No other configurations options are necessary.

Configuring a multisite network to use subdomains

If you want to use subdomains instead of subdirectories, you'll need to add a few more options to your configuration file.

# inventory/host_vars/wordpress.example.com/vars.yml

wordpress__multisite: True
wordpress__multisite_subdomains: True
wordpress__nginx__server_name: [ 'wordpress.example.com', 'test.wordpress.example.com' ]

wordpress__multisite_subdomains tells DebOps to configure the multisite network to use subdomains instead of subdirectories. You also need to configure Nginx to listen for other subdomains besides wordpress.example.com. The wordpress__nginx__server_name option is in charge of that. It's a list of domain names that Nginx will listen to for your network site.

If you don't feel like entering a new domain name every time, you can use * as a wildcard. Your list of domain names would then be [ 'wordpress.example.com', '*.wordpress.example.com' ]. Even with the wildcard, you still need to keep wordpress.example.com. That's because the wildcard does not work for the top level domain.

It's also worth noting that DebOps does not add new DNS records for your subdomains. You have to do that yourself.

Configuring the server

If you're creating a new WordPress site as a multisite network, you need to configure a brand new server. That means that you need to create a new server with your cloud hosting provider. Once your new server is up and running, you'll want run the debops commands.

$ debops bootstrap -u root
$ debops
$ debops wordpress

If you converted an existing site to a multisite network, you do not need to go through all these steps. You only need DebOps to update the configuration of your server. You can do that by running the WordPress DebOps playbook.

$ debops wordpress