Tutorial

How To Set Up Multiple WordPress Sites Using Multisite

Updated on March 14, 2021
How To Set Up Multiple WordPress Sites Using Multisite

About Multiple WordPress Installs

In 2010, WordPress released version 3.0 of it popular content management platform. Among the many improvements included in the release, the WordPress community combined WordPress MU into the main WordPress configuration. Since the change, WordPress has made it easier to create multiple WordPress sites on one server. Whereas earlier, each WordPress blog on a server needed to have its own installation, now a new WordPress site can be installed once, and other blogs can be set up from within the WordPress dashboard.

Setup

The steps in this tutorial require the user to have root privileges. You can see how to set that up in the Initial Server Setup

Before working with WordPress, you need to have LAMP installed on your virtual private server. If you don't have the Linux, Apache, MySQL, PHP stack on your VPS, you can find the tutorial for setting it up in the Ubuntu LAMP tutorial.

Once you have the user and required software, go ahead and Install WordPress. However—make sure you stop at the end of step 4 (We will add one more thing to the Wordpress config file in the next step)

Step One—Setup Your WordPress Installation


With WordPress installed, we need to take a series of steps in a variety of configuration files.

To begin with, modify the WordPress configuration, activating the multisite networking:

sudo nano /var/www/wp-config.php

Add the following line above "/* That’s all, stop editing! Happy blogging. */"

/* Multisite */
define('WP_ALLOW_MULTISITE', true);

After that save the file and exit. You can do so by pressing CTRL+O to save and then followed by CTRL+X to exit.

Activate the apache Mod_Rewrite module:

sudo a2enmod rewrite

Follow up by permitting .htaccess changes in the virtual file. Open up your virtual host file (I am simply going to make these changes in the default Apache one).

sudo nano /etc/apache2/sites-enabled/000-default

In the following section, change AllowOverride to All:

<Directory /var/www/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
                Order allow,deny
                allow from all
</Directory>

Restart apache:

sudo service apache2 restart

Once that is all done, the WordPress online installation page is up and waiting for you:

Access the page by adding /wp-admin/install.php to your site's domain or IP address (eg. example.com/wp-admin/install.php) and fill out the short online form.

Step Two—Setup Multiple WordPress Sites

Go into your WordPress dashboard and select the section called tools:

networking setup

Once you have filled out the required fields, go through the directions on the next page (I have elaborated on them further under the image):

next page
  1. Create a directory for your new sites:
    sudo mkdir /var/www/wp-content/blogs.dir

  2. Alter your WordPress configuration. Make sure to paste this above the line /* That’s all, stop editing! Happy blogging. */:
    sudo nano /var/www/wp-config.php
     define('MULTISITE', true);
    define('SUBDOMAIN_INSTALL', false);
    $base = '/';
    define('DOMAIN_CURRENT_SITE', 'YOUR IP ADDRESS HERE');
    define('PATH_CURRENT_SITE', '/');
    define('SITE_ID_CURRENT_SITE', 1);
    define('BLOG_ID_CURRENT_SITE', 1);
  3. Finally, add WordPress’s rewrite rules to /var/www htaccess file:
     sudo nano /var/www/.htaccess
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    

    uploaded files

    RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]

    add a trailing slash to /wp-admin

    RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]

    RewriteCond %{REQUEST_FILENAME} -f [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^ - [L] RewriteRule ^[_0-9a-zA-Z-]+/(wp-(content|admin|includes).) $1 [L] RewriteRule ^[_0-9a-zA-Z-]+/(..php)$ $1 [L] RewriteRule . index.php [L]

After making all of the necessary changes, log into WordPress once more.

Step Three—Setup Your New WordPress Site

After you log into your site once again, you will notice that the header bar now has a section called, “My Sites” instead of simply displaying your blog’s name:

header

You can create new sites by going to My Sites at the top, clicking on Network Admin, and clicking on Sites:

create a new site
By Etel Sverdlov

Thanks for learning with the DigitalOcean Community. Check out our offerings for compute, storage, networking, and managed databases.

Learn more about our products


About the authors

Still looking for an answer?

Ask a questionSearch for more help

Was this helpful?
 
10 Comments


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

sudo nano /etc/apache2/sites-enabled/000-default

LPT: Never do anything in /site-enabled/. Use /sites-available/. The changes propagate through to sites-enabled via Apache2 magic.

I followed this and the only other tutorial and information I could find on setting up a Multisite with WP on Digital Ocean and the result was an entire day lost to tickets that could not be answered or resolved with DO’s help system. Eventually, I found the answer on my own.

Wordpress Multisite set-up appears to not be any different under D.O. than it is on any other WP Multisite install. If you use One-Click WP Install, all you have to do is install WP with one-click, then follow step one above:

sudo nano /var/www/wp-config.php

Add the following line above “/* That’s all, stop editing! Happy blogging. */”

/* Multisite */ define(‘WP_ALLOW_MULTISITE’, true);

After you have done this you can log back into your WP install and find the Network Install under “Tools” in WP’s Dashboard (again, just like any other WP multisite install). Once you click install on the Network, WP itself will prompt you for the additional changes you need to make to wp-config and .htaccess files.

Someone should write up a tutorial for One-Click install of WP with Multisite Enabled. I’m someone who has already worked with wildcard domains and managing/mapping a wordpress multisite. So, I already knew those steps. But this REALLY BASIC information was missing from DO’s tutorials.

I just learned that the change I referred to previously in regard to blogs.dir is due to a change in how Wordpress handles multisite uploaded_file_path after version WP 3.5.

http://codex.wordpress.org/Multisite_Network_Administration#Uploaded_File_Path

This article should probably be updated to reflect the change.

how about installing mutiple ssl for mutiple domains when using wordpres multisite, do you know any guide?

Its similar but a little bit simpler to do the same thing with a one click WordPress droplet. I don’t want to give all the steps here because I am a newbie but just wanted to point out that a tutorial focusing on multi sites and the one click droplet would be nice. Alternatively, is it possible to change the first run script so that the installer has the option of enabling multi sites from the start?

Hello DO team.

Can I use this same tutorial to setup a wordpress 5.8 multisite on Ubuntu 20.04?

Thanks.

Not sure why someone, unless very inexperienced with WordPress would set it up with Apache, especially a WordPress Network.

A NGINX tutorial would be great :) Only one I found on DO is this one: https://www.digitalocean.com/community/tutorials/how-to-set-up-wordpress-multisite-with-nginx-on-ubuntu-14-04 but also very old.

Cheers!

how do I exit modifying php config in DO console?

oups… finally, this is not what I want, I’d rather have two wordpress installed side by side on the same Droplet (I Gg RAM, 30Gg SSD, 2TB transfer); do you have a tutorial for that?

How shall I proceed?

Thx, Denis Paul

Hi Etel, is this post information still accurate today?

Can I just proceed with a one-click Wordpress on 16.04 install and then add the above instructions onto my wordpress to configure it for multi-sites ???

Thanks, Denis Paul

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Join the Tech Talk
Success! Thank you! Please check your email for further details.

Please complete your information!

Featured on Community

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel