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!

13 thoughts on “Getting started with Elgg Multisite

  1. Thanks Marcus, Its very helpful for our community.
    One question :
    I need to manage in single database. Please give intro to do that.

  2. Having multiple sites in a single database isn’t the purpose of this tool, although basic support has been built into Elgg from very early on (the site ID on objects). We didn’t really make much use of it because it wasn’t the most efficient way of doing it from the database point of view so we didn’t write the admin infrastructure around it.

    I believe work has been done in the community to provide this interface, and you could take a look at community.elgg.org…

  3. Thanks a lot for what you did, it was very useful and you solved the problem of having multiple sites with one elgg core in a very smart way.

  4. I am new to subject. It sounds very attractive option, rather than setting up individual installations. Thank youç I would like to test it out. I checked elgg.org multisite group, not much activity. On the github it has last been updated for 1.8.15. I can test it for 1.8.16 but before anything, will it be available for new versions of elgg? Thanks

  5. Not had a chance to try with 1.12 yet, but the answer is probably Yes, with a but 🙂

    That but being you’ll probably have to do some modification to the replacement plugin manager to remove any deprecated functions, and to port any new themes.

  6. Thanks for your reply ….
    I have one more problem….
    I m trying to install multisite elgg 1.8.3 version on localhost (xampp server) but i have a confusion and got some errors:

    confusion is that: as u told in documentation is there need to define virtual host on localhost?
    if yes then please tell me how cause i could not get this from documentation.

    and notices are showing when i m installing the multisite elgg

    Notice: Undefined property: stdClass::$elggmulti_link in D:\web\htdocs\elggmulti\docroot\engine\lib\multisite.php on line 295

    Notice: Trying to get property of non-object in D:\web\htdocs\elggmulti\docroot\engine\settings.php on line 37

    Notice: Trying to get property of non-object in D:\web\htdocs\elggmulti\docroot\engine\settings.php on line 38

    Notice: Trying to get property of non-object in D:\web\htdocs\elggmulti\docroot\engine\settings.php on line 39

    Notice: Trying to get property of non-object in D:\web\htdocs\elggmulti\docroot\engine\settings.php on line 40

    Notice: Trying to get property of non-object in D:\web\htdocs\elggmulti\docroot\engine\settings.php on line 41

    Notice: Trying to get property of non-object in D:\web\htdocs\elggmulti\docroot\engine\settings.php on line 42

    Notice: Undefined index: user in D:\web\htdocs\elggmulti\multi\pages\titlebar.php on line 7

    Notice: Undefined index: user in D:\web\htdocs\elggmulti\index.php on line 38

    and one notice is shown in user input field..

    Please reply me regarding this..

    Thank You..brother

  7. Thanks For Reply Marcus,

    will you please ellaborate me that Which modules and function we have to modify if we forcefully want to upgrade Multisite Elgg with latest Elgg ?
    Its need to know,
    So, Please try to reply me soon…

Leave a Reply