Wordpress Multisite in a classroom environment

After being inspired by Point England School (for about the millionth time) I'm going to aim to have one blog per learner in my class next year. Here's how we're achieving it technically.

To achieve this I looked at a couple options:

  • Wordpress.com (hosted blogs for each learner)
  • Blogger.com (hosted, connected to our Google Apps account). This is what Point England school use
  • Self-hosted Wordpress installations (several separate folders and databases)
  • Wordpress Multisite

This year we have been self-hosting a Wordpress installation, and it's worked really well. Removing the upload times for videos and photos has really helped the kids jump into the blogging concept and it's been a much busier site than our previous externally hosted option. Wordpress is simple and extremely customisable so Wordpress Multisite is what I chose to use.  

Multisite flavours

Depending on your network set up there are a couple options for how you set up Multisite.

    • BitNami Wordpress Multisite is a packaged up installer designed to do *most* of the work setting up WP Multisite.
      Because you can't (or I couldn't figure out how to) install this on a machine running an existing Web Server via. port 80, this wasn't an option for us. It might be a good fit for schools purchasing a Mac Mini solely for running their blog service. You'd still need to set up your DNS correctly but it removes the need for database installation and WP configuration. 
    • Using a Wordpress.org provided installation, and upgrading it to Multisite.
      We chose this option because our server also runs other web services (profile manager, legacy blogs, web help desk etc) which didn't seem to work well with the BitNami set up. 

    Setting Up Wordpress Multisite

    We're running Mac OS X Server 10.7.3 (don't get me started on why we haven't upgraded to 10.8.n yet) so the instructions below focus on this setup. It should be much the same for 10.6.n- 10.8.n installations.

    With Wordpress Multisite you have two options for how it addresses your blogs. 

    • blogname.yourserver.co.nz or
    • yourserver.co.nz/blogname

    I opted for the former, because it gives the kids more ownership over their blog, plus it's easier to explain to them how the domain name addressing works. We're using blogname.blogs.takp.school.nz, not just because I like extra dots, but because it helps differentiate kids work from official school documentation. 

    Create a Web Server Site

    1. Using the Server Utility, enable 'Web Server' and create a new site. Don't use the existing default share because it has special characteristics for Mac OS X's wiki and collaboration features that get in the way of configuring .htaccess correctly.
     
    Wordpress is a php application so ensure you've ticked 'Enable PHP web applications'. 

    Mac OS X Web Server

    Mac OS X Web Server

    In the new site set up your details and SSL certificate if you want to use one. Pick a place to store the website on the server and ensure that 'Allow Overrides' is ticked - you'll need this for the tidy urls in your .htaccess file to work properly.

    If you are opting to use blogname.yourname.co.nz as your addressing scheme you need to add a wildcard additional domains - for example *.yourserver.com, or, for us *.blogs.takp.school.nz.

    Mountain Lion Server users will need to use emacs to do this manually. For some reason Apple removed this from Mountain Lion's Server feature set (at least in 10.8.2).

    The file you need to modify is stored in 

    /Library/Server/Web/Config/apache2/sites/0000_any_<port>_example.com.conf

    Use emacs to modify the file, and just before </VirtualHost> put the line:

    ServerAlias *.example.com (obviously change example.com to your domain.TLD). 

    Web Server Options - Mac OS X

    Web Server Options - Mac OS X

    Install Wordpress

    Download Wordpress and install a normal installation into the web folder you've made for your web service. Installing Wordpress takes a little bit of work and some vigorous head scratching (especially during the database setup). 

    I used MySQL Workbench and this tutorial to get me through the installation of Wordpress and a database. You do not need to go through Step 4 of the tutorial on Lion Server (fiddling with httpd.conf) because these settings are now managed in the Server.app. 

    Configure for Multisite

    Now that you've:

    • Installed Wordpress
    • set up a database
    • and modified your permissions

    You're ready to convert your site to a Wordpress Network. I used the instructions on the Wordpress Codex to upgrade to a Network, but I'll summarise them here. 

    1. Decide on which domain scheme you want to use, blogname.server.com or server.com/blogname.
    2. Enable Wordpress Multisite in your config file:

      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:


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

      You will need to refresh your browser to continue.

    3. Log into your new Wordpress site and follow the instructions to install the network. This is pretty self-explanatory but you'll need to use a command line tool, like emacs, to modify .htaccess. To load .htaccess in emacs fire up terminal, change to the directory where wordpress is installed and type:

      sudo emacs .htaccess

      You will need to save the file by hitting CTRL-X, CTRL-S (not command) after making the changes. CTRL-X, CTRL-C will quit emacs. 

    Setting Up Wildcard DNS

    You've set up everything you need for your Wordpress Network to work, except DNS. You need to make a couple changes to your DNS service on your server and your domain host for things to fit together. You only need to do this if you're using blogname.servername.com, not if you're using servername.com/blogname/ as an addressing scheme.

    Setting Up Wildcard DNS on Mac OS X Server

    For some bizarre reason Mac OS X Server doesn't support Wildcard domain names, which you need to have unlimited potential blogs hosted on your server. You've got to do a bit of hacking to figure things out, but it's not too tricky. This will allow internal traffic to access your blogs correctly.

    For our setup we wanted *.blogs.takp.school.nz, where the * indicates the name of the individual blog(s). You need to set up a wildcard DNS entry that replaces translates the blogname to the Wordpress application. We use the * wildcard to do this.

    I used this ServerFault question to figure out how to get this working.

    1. Fire up Server Admin, and go to the DNS section.
    2. Create a new phoney DNS Machine 'A' record under your top level domain for your blogs.
      Make this up based on what one of your blogs might be addressed as. Our domain name scheme for blogs is *.blogs.takp.school.nz. - so I entered in wildcard.blogs.takp.school.nz. into our DNS settings. 
      Point this new record to the internal IP address of your Wordpress server.
    3. Save the changes, restart the DNS service and quit Server Admin.
    4. Fire up emacs and edit your dns settings using the command:

      sudo emacs /var/named/db.DOMAIN.TLD
      where db.DOMAIN.TLD is your domain. For example, ours is db.takp.school.nz
    5. Use the arrow keys to find the domain you just created (wildcard.blogs.takp.school.nz in my example) and change the text before the first . to a *. For example, I'm going to change wildcard.blogs.takp.school.nz. to *.blogs.takp.school.nz. 
    6. Save the file with CTRL-X CTRL-S and quit emacs with CTRL-X, CTRL-C. When you go back into Server Admin's DNS settings you'll see your wildcard entry there.

    Setting Up Wildcard DNS on your domain for external traffic

    The last step you need to do is set up the same wildcard DNS for external traffic. For us, this was hosted by the same people who host our school website. Adding a wildcard entry was really easy- but how to do it will depend on whoever your domain registrar is. The simplest way to do it is to email their support desk and ask for a wildcard domain to be set up pointing to your static IP.

    You're done!

    All going well you should now have a working Wordpress Network, ready to handle one blog per child (or classroom) and completely under your control.

    • Remember, blog owners can only install plugins and themes you choose, so install plugins and themes you think are appropriate and activate them.
       
    • The MultiPost plugin is a great way to foster collaboration across your sites, so that learners working in a group can all have finished work published on their sites.

    Happy blogging!