WordPress Multisite Installation Walk-through

Runtime: About 45 minutes

This walk-through is for anyone interested in setting up a new WordPress Multisite configuration. It’s a step-by-step guide to getting WordPress Multisite up and running beginning with a clean WordPress 3.3.2 installation. It is recommended that you read this entire article before jumping in headlong.

This article also assumes that you can use the terminal (unix prompt) and know how to do other geeky stuff.

Prerequisites:

  • General familiarity with WordPress
  • Comfortable with basic Unix commands
  • FTP and/or terminal access to your server (domain or localhost)
  • Familiarity with Apache2 configuration files (e.g. httpd.conf file or sites-available)
  • Decide whether to use sub-domains or sub-directories for each of your sites.
    e.g. example.com and myothersite.example.com
    or example.com and example.com/myothersite
    hmm… decisions, decisions.

Step 1: Install a Clean Copy of WordPress

Install a clean build of WordPress 3.3.2 (or later) on your server. (Either localhost or on a domain. In this case, I’m doing this for a new domain.)

WordPress 3.3.2

Step 2: Enable Multisite

Once WordPress is installed, the first thing you’ll want to do is enable Multisite. This takes a little configuration of your wp-config.php file as well as your server’s Apache configuration file — so it’s a little more convoluted than your typically easy WordPress plug-in install. That’s okay, though. This guide will walk you through each step.

Step 2a:

Deactivate all active plugins.

Step 2b:

Edit your wp-config.php file to enable Multisite.

Open up wp-config.php and add this line above where it says /* That’s all, stop editing! Happy blogging. */. If it doesn’t say that anywhere, then add the line somewhere above the first line that begins with require or include:

1
define('WP_ALLOW_MULTISITE', true);

You will need to refresh your browser to continue.

(source: http://codex.wordpress.org/Create_A_Network)

If that worked, you should see a new option under “Tools” called “Network Setup”

WordPress Network Setup

Step 3: Create a Network in your Multisite-enabled WordPress Installation

If you started with a clean install of WordPress (like me) and you are running your new WordPress installation on a domain (in my case “achievemyedge.com,” then you will see something like this:

WordPress Create a NetworkIf you are running as localhost or using an existing wordpress installation, you will see see a different set of choices. (I won’t go through all the other possibilities, as this article assumes you’re starting from scratch on a domain.)

WordPress warns you:

Please choose whether you would like sites in your WordPress network to use sub-domains or sub-directories. You cannot change this later.

In my case, I am going with the first option: sub-domains. Then, after I choose “Install”, I see this screen with some additional instructions:

WordPress Multisite Installation

Step 4: Manual Configuration

Next, the wordpress codex tell us there are three steps. Please read this entire section first before proceeding.

1. Create a directory for media file uploads

This directory must be writable by the web server, the same as your wp-content directory.

(Source: http://codex.wordpress.org/Create_A_Network)
Author’s note: As an experiment, I decided to skip this step and see what happened if I went with the the traditional “Uploads” directory which is where media files are stored by default. The results of my experiment are reported at the end of Step 4.1.
In another article, the WordPress Codex says this:

Your first site on a fresh install will put uploaded files in the traditional location of /wp-content/uploads/, however all subsequent sites on your network will be in the /wp-content/blogs.dir folder, in their own subfolder based on the site number, designated by the database. These files will be accessible via the URLs http://example.com/files/ and http://example.com/sitename/files and so on. For example

Blog #1:

/wp-content/uploads/YYYY/MM/image.jpg
http://example.com/files/YYYY/MM/image.jpg

Blog #2:

/wp-content/blogs.dir/2/files/YYYY/MM/image.jpg
http://example.com/blog2/files/YYYY/MM/image.jpg or http://blog2.domain.com/files/YYYY/MM/image.jpg

These locations cannot be changed by site admins. Only the network admin can make changes on the site settings page. It is not recommended that you change these without understanding how both the ms-files.php works in conjunction with your .htaccess, as it can easily become non-functional. If the /files/ urls aren’t working, it’s indicative of a misconfigured .htaccess or httpd.conf file on your server.

(Source: http://codex.wordpress.org/Multisite_Network_Administration)

Author’s note: As I said, I skipped this step. After uploading test files to both my primary and secondary blogs, I looked at the locations:

e.g. Primary: http://achievemyedge.com/wp-content/uploads/2012/04/test1.png

e.g. Secondary: http://edgelearning.achievemyedge.com/files/2012/04/test2.png

WordPress automatically created a folder called blogs.dir inside my wp-content directory. So, in other words: Skip this step.

Now, aren’t you glad you read ahead?!

2. Add the specified lines to your wp-config.php file

The extra lines go just after where you added the line in Step 2b.
In my case the instructions read like this:

Add the following to your wp-config.php file in /var/www/achievemyedge.com/ above the line reading /* That’s all, stop editing! Happy blogging. */:

1
2
3
4
5
6
7
define( 'MULTISITE', true );
define( 'SUBDOMAIN_INSTALL', true );
$base = '/';
define( 'DOMAIN_CURRENT_SITE', 'achievemyedge.com' );
define( 'PATH_CURRENT_SITE', '/' );
define( 'SITE_ID_CURRENT_SITE', 1 );
define( 'BLOG_ID_CURRENT_SITE', 1 );
WordPress Multisite added code to wpconfig

3. Add the specified lines to your .htaccess file

If you do not have a .htaccess file, then create it in the same directory as your wp-config.php file.
In some cases you might also have to add Options FollowSymlinks at the start of the file.
In my case, the instructions read like this:

Add the following to your .htaccess file in /var/www/achievemyedge.com/, replacing other WordPress rules:

1
2
3
4
5
6
7
8
9
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
# uploaded files
RewriteRule ^files/(.+) wp-includes/ms-files.php?file=$1 [L]
RewriteCond %{REQUEST_FILENAME} -f [OR]<br />
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule . index.php [L]
WordPress Multisite .htaccess rules

After completing these steps, log in again using the link provided. You might have to clear your browser’s cache and cookies in order to log in.

WordPress Log In

I noticed in my case that I had to hard refresh my browser before I saw any changes. Just FYI.

If everything went according to plan, you should now see a slightly different looking WordPress Dashboard.

WordPress MultiSite Dashboard

Something’s Different…

 

The WordPress codex warns that you should bone up on your WordPress Administration:

There are some additional things you might need to know about advanced administration of the network, due to the additional complexity of a Multisite. Even if you’re familiar with WordPress, the location and behavior of Multisite Network Administration can be confusing.

(Source: codex.wordpress.org/Create_A_Network)

That’s probably good advise.

Step 5: Create additional sites in your network.

Go to My Sites -> Network Admin -> Dashboard and then Create a New Site.

WordPress Multisite Site List

In my case, I want to create a sub-domain called “edgelearning”

WordPress Multisite New Site ExampleAfter I clicked the Add Site button, I had to WAIT about 2 minutes. BE PATIENT!!!

As soon as the next screen loads, you should see two sites listed under My Sites.

WordPress Multisite My SitesIMPORTANT! If you haven’t configured this new sub-domain in your Apache configuration, you’ll need to do that next!

Since I run my own box, I configure Apache manually. In my case, the lists of sites available on my server are stored in a file at: /etc/apache2/site-available/default

(On some installations your Apache config file may be located at /private/etc/apache2/httpd.conf )

The following is an excerpt from my Apache /etc/apache2/site-available/default file. I’ll add in support for my new sub-domain.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#achievemyedge.com
<VirtualHost *:80>
    ServerAdmin alex_williams@techism.com
    DocumentRoot /var/www/achievemyedge.com
    <Directory /var/www/achievemyedge.com>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        allow from all
    </Directory>
    ServerName achievemyedge.com
    ServerAlias *.achievemyedge.com
    ErrorLog "/var/log/apache2/achievemyedge-error_log"
    #CustomLog "/var/log/apache2/achievemyedge-access_log" common
</VirtualHost>

All I’ve done is add a wildcard (*) under the ServerAlias. WordPress will take care of the sub-domain resolving correctly.

IMPORTANT: Remember to restart Apache!!!

At the Unix prompt, type:

1
service apache2 reload

(Or restart Apache using your web hosts control panel if you’re not comfortable at the command line.)

Next, test your primary domain and sub-domain and make sure they are resolving correctly. Hopefully, that worked. (If not, the first thing is to make sure that you restarted Apache.) By default, your new (2nd) wordpress website will use the “WordPress 2012″ theme.

You can now administer each site independently. Congratulations!

Further Reading and References:

WordPress MU Domain Mapping (WordPress Codex)

http://wordpress.org/extend/plugins/wordpress-mu-domain-mapping/

Migrating Multiple Blogs into WordPress 3.0 Multisite (WordPress Codex)

http://codex.wordpress.org/Migrating_Multiple_Blogs_into_WordPress_3.0_Multisite

Create A Network (WordPress Codex)

http://codex.wordpress.org/Create_A_Network

Multisite Network Administration (WordPress Codex)

http://codex.wordpress.org/Multisite_Network_Administration

Multisite User Management (WordPress Plugin)

http://wordpress.org/extend/plugins/multisite-user-management/

This entry was posted in Techno-babble, WordPress. Bookmark the permalink.

6 thoughts on “WordPress Multisite Installation Walk-through

  1. Islam Muslim says:

    Thank’s for this (WordPress Multisite Installation Walk-through) great tutorials. I was having a hard time with those.

  2. Denis says:

    I set up multisite and the subdomains could not load – error. The only thing I didn’t try is configuring apache and you said it as easy as abc but I couldn’t even locate where Apache is. Where is it?Now I am inside my cpanel and I couldn’t find it anyways. Is it Apache handlers?

  3. CloudInside says:

    Good tutorial, clear. I read all stuff on the WP codex but didn’t find a tutorial from a fresh install. i supposed it would be different but…it isn’t. It would be much better if on installation of WP we would be able to choose for single / mu. I did several installs yesterday on a Windows machine with IIS but all installs resulted in the error that the site kept loading on the “site registration/subscription” page. My blog was not shown. When i set MU to false in the wp-config the blog came up again. Strange thing though is that i see this error all the time on the web but none of the solutions helped. I post this here to see if you know any solution.

    Keep up the good work!

    • Alex Williams says:

      I’ve run into this site registration/subscription page before when trying to access a new blog on multisite. I would check two things:
      1) make sure the domain or subdomain for the new blog is configured in Apache or IIS to point to your primary domain as an alias. Once the domain is resolving to your WordPress Multi-Site primary domain, WordPress multi-site will serve the correct blog.
      2) Use the Domain Mapping plug-in to make sure you’ve mapped the subdomain (or domain) to the correct blog.

      Let us know if you figure it out.

  4. Justin says:

    Thank you for the Apache config example, just what I needed.

    You’ve gathered all the snippets from various sources and put them all in one place.

    An excellent tutorial, thank you (wish I’d found your site first!!) :-)

  5. Bohumil says:

    Great guide, everything explained nicely. I have also used some information from the following guide because i have centos server.
    http://www.rosehosting.com/blog/how-to-install-wordpress-multisite-on-centos-vps-with-apache/

Leave a Reply

Your email address will not be published. Required fields are marked *


*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>