Elgg Multisite is a version of the popular social networking platform Elgg which lets you easily run multiple Elgg sites off a single install of the software, starting new Elgg sites at the click of a button.

Here’s how to get started…

What you’ll need

In addition to the existing Elgg system requirements (PHP 5.2+, Mysql, Apache) you will also need:

  • Control over your apache config: You will need to set up apache virtual hosts for each domain you want to run an Elgg site on and point it at your Elgg Multisite docroot. This is also true if you want to use wildcard subdomains (below).
  • A DNS provider that supports wildcard subdomains: Wildcard subdomains let you direct anything.yourdomain.com to a common endpoint, while preserving the request headers. This lets you serve up different content depending on whether you visit http://sitea.yourdomain.com vs http://siteb.yourdomain.com but without any extra configuration. This is the recommended Elgg Multisite setup.
  • A domain to act as the “Master”: Visiting this domain will bring up the Elgg Multisite control panel, so you’ll want to protect behind some form of access control. I recommend you modify your apache configuration to limit access to a handful of trusted IP addresses.

Installation

For this I am assuming you’ve got the domain example.com. You have your admin page at http://admin.example.com and your Elgg sites are at http://*.example.com.

  1. Download the source: Elgg Multisite is available on Github, either checkout the source and run the build.xml (you’ll need ant) or download the pre-built package for Elgg 1.7 or Elgg 1.8.
  2. Install the source to a suitable location: Unpack the Elgg Multisite and install the contents to a suitable location (e.g. /var/www/). You should end up with an index.php, plus the following sub directories…
    • schema: Holds the Elgg multisite admin database schema.
    • multi: Elgg multisite admin libraries.
    • docroot: The customised Elgg install where you will point your Elgg domains to.
    • data: Elgg multi’s data root, this will contain the data uploaded by your Elgg sites.
  3. Make the data directory writable: the previously mentioned data directory must be writable to the apache user (e.g chown www-root:www-root data; chmod 775 data; on most systems).
  4. Install the admin database schema: Install /var/www/schema/multisite_mysql.sql in a mysql database. Be sure to give the Elgg multisite admin user you configure in the next step the ability to create new databases!
  5. Rename /var/www/docroot/engine/settings.example.php to settings.php and configure the administration database settings:
    • $CONFIG->multisite->dbuser = 'your admin database user';
    • $CONFIG->multisite->dbpass = 'password';
    • $CONFIG->multisite->dbhost = 'host usually localhost';
    • $CONFIG->multisite->dbname = 'admin database name e.g. elggmultisite';

Configuring your domains

The next step is to set up your Apache virtual hosts to point to the appropriate locations in your Elgg Multisite install.

  1. Set up your admin domain: Point a domain at your admin root /var/www/, e.g

    <VirtualHost *>
    ServerAdmin webmaster@example.com
    ServerName admin.example.com
    DirectoryIndex index.html index.php
    DocumentRoot /var/www/
    UseCanonicalName off
    php_admin_flag engine on
    php_admin_flag safe_mode off
    <Directory "/var/www/">
    AllowOverride All
    Options +Indexes +Includes +FollowSymlinks +ExecCGI
    </Directory>
    </VirtualHost>

  2. Set up your Elgg Multi-site wildcard domain handler:

    <VirtualHost *>
    ServerAdmin webmaster@example.com
    ServerName hosts.example.com
    ServerAlias *.example.com
    DirectoryIndex index.html index.php
    DocumentRoot /var/www/docroot/
    UseCanonicalName off
    php_admin_flag engine on
    php_admin_flag safe_mode off
    <Directory "/var/www/docroot/">
    AllowOverride All
    Options +Indexes +Includes +FollowSymlinks +ExecCGI
    </Directory>
    </VirtualHost>

  3. Set up the appropriate hosts and wildcard domains with your DNS provider: You need to set up your DNS correctly for this configuration to work, and this is host specific. Your DNS provider can help you further.

Setting up your admin user and adding sites

Once you have set up everything, visit http://admin.example.com and you will be prompted to enter details for the administrator user.

You can then begin setting up and configuring individual Elgg sites!

Enjoy!

Many moons ago I wrote an extension to Elgg which allows you to run multiple Elgg sites off of a single install of the codebase.

Following some feedback from the wider world, as well as Elgg’s decision some time ago to move over to github I’ve tidied up the archive and moved it over to github as well.

I have taken the opportunity to perform a provisional migration to support Elgg 1.8, although there are bound to be some outstanding issues. Hopefully this github archive will make collaboration a little bit easier!

Have a play!

» Github Project Page

Latest: Elgg Multisite is still active and has moved on to Github. Go join in!

I have just Open Sourced an “itch scratching” project I’ve been hacking on for a little while. So, without much further ado, I’d like to introduce you to Marcus Povey’s Multisite Elgg!

It is currently in Beta and the code could do with a bit of a tidy, but this is Open Source so roll up your sleeves and get involved.

What is it?
Multisite Elgg allows you to run multiple separate Elgg sites off of the same install of the codebase, saving disk space and making administration a whole bunch easier.

Currently based around the latest Elgg 1.7 release, once installed adding new Elgg sites is a matter of clicking on a button and entering in some details.

What can I do with it?
You can do everything that you can do with Elgg, but with the ability to create new networks on demand. This will for example let you:

  • Set up your own version of Ning! What with Ning phasing out free accounts, it is my hope that Multisite Elgg will let a thousand more Nings bloom!
  • In your organisation or institution, easily set up Elgg sites for each department.
  • If your one of the Elgg hosting companies out there, you may want to look at multisite in order to simplify your work flow.
  • … etc…

Installation
Once you have downloaded the installation package you will need to do a few things in order to get up and running. Multisite Elgg assumes that you have some knowledge of how to set up and run a server – there is no wizard just yet!

  1. Unzip the package on your web server.
  2. Point your master domain at the contents of the install location on your web server. This is your master control domain, go here to configure your sites. Because of this you might want to consider putting this behind some further access restrictions.
  3. Point any sub domains to the contents of the docroot folder, eg (/var/multisite/docroot). This directory forms the base of all your Elgg installs. To make things even more automated you may want to consider making this an Apache wildcard domain, if your DNS provider supports it.
  4. Chmod 777 docroot/data: This is the default location for multisite domains.
  5. Install schema/multisite_mysql.sql: Create a new database on your Mysql server and install the Multisite schema – this is your master control database.
  6. Rename settings.example.php in docroot/elgg/engine/ to settings.php and configure:

    $CONFIG->multisite->dbuser = ‘your username’;
    $CONFIG->multisite->dbpass = ‘password’;
    $CONFIG->multisite->dbhost = ‘host’;

    Make sure this user has sufficient privileges to create and grant access to databases and tables on your server. This will allow the admin tool to create the databases for your hosted sites automatically.

  7. Visit your master domain and configure your admin user
  8. Begin configuring your sites!

Creating sites
Once you have created an admin user, adding sites is easy. Currently you can only create one type of site, but in the future Multisite Elgg will let you create sites which have quotas and other access restrictions.

You have a box to enter database details, or you can leave them blank to use Multisite Elgg user defined above (which you may not want to do for security reasons).

You can also select which of the installed plugins you want to allow, this lets have different sites have different plugins available while still installing them on the same codebase.

Contributing
So, that was a brief introduction to Multisite Elgg. I hope that at least some of you out there find it useful!

As I said before, it’s Open Source, so if you want to get involved here are the important details:

If you want to contribute patches, feel free to use the bug tracker or discussion forum!

Enjoy!