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!

34 thoughts on “Multiple site support with MP’s Multisite Elgg

  1. @Marcus – I will be definitely definitely looking deeper into (even if you call it ‘beta’). Hope other things are going fine for you.. Miss your posts @ the community ;-( but there’s always this here blog 😉

    Regards,
    DC.

  2. Marcus, how does this compare with Fabrice’s multisite plugin, or elgg’s multisite commercial option?

  3. I believe Fabrice’s plugin uses a different method which requires more modifications to the core code and may cause issues with the way some plugins work – not sure without looking at the code.

    Re curverider’s offering, I don’t know as I haven’t used it or have access to the code.

  4. Keep getting the “There was a problem creating the new user, are you sure it doesn’t already exist?” when registering for admin for the first time. Have not created the user before. Also tried with different username, failed.

    Any idea why this happens Marcus ?

  5. Hmm… have you checked that the management database has been installed & that the main user has full access. Also you might want to check the log and see if there are any errors reported by mysql_error()

  6. No, they’re completely separate sites.

    The correct way to solve this problem I think is to look at proper federalisation – that way it’s optional and will work on any elgg site regardless of whether its a multisite install.

    Part of the solution is OpenID.

  7. @Marcus what i am doing is hosting more than one site withing the same physical codebase, i would like diff themes for each site depending on url but the same userlogins and files.
    As for federalization this is something badly needed among sites, but they all intend to keep your data in separate places for each site and the users dont like this. They like using a login on another site (like openid) but they do not like files and comments not going back to their homesite.

    btw loved your opensores radio, you and ben should duuit again.

  8. Marcus,
    I have your multisite set up at minnaram.com. I can create subsites successfully as well. I want to point a domain to a subdomain created with multisite.
    For eg,
    I have cubet.minnaram.com. I want cubettech.com point to cubet.minnaram.com. How do we do it?
    DO we need to make any enhancements with the code to achieve this?
    Please advise.

  9. If all you want to do is have different themes based on URL, then that should be fairly straight forward. I think the simplest way to implement this would be to base it on the elgg views system which already provides RSS, JSON & Failsafe “themes”.

    I imagine the approach would go something like this:

    1) Copy MYELGGSITE/views/default to MYELGGSITE/views/THEMENAME, making sure you copy subdirectories as well. Replace THEMENAME with the name of your theme (or any name, so long as you remember it and it is unique for each theme you install)
    2) Install your theme. Look in MYELGGSITE/mod/mytheme/views/ and rename ‘default’ to THEMENAME from step 1
    3) Log in and activate the theme
    4) Repeat 1 – 3 for each theme you want to install

    Finally, you will need to have something to select between views based on the incoming domain. Some code along the lines of:

    switch($_SERVER[‘SERVER_NAME’])
    {
    case ‘foo.com’: set_input(‘view’, ‘theme1’); break;
    case ‘bar.com’: set_input(‘view’, ‘theme2’); break;
    … etc …
    default: set_input(‘view’,’default’); break;
    }

    This should go somewhere in engine/start.php, I suggest replacing :

    // System booted, return to normal view
    set_input(‘view’, $oldview);

    Although you might need to play around with it, especially to get RSS views etc to work.

  10. @lovegin No, you don’t need to do any code changes. What you need to do is:

    1) point the domain at the webserver
    2) set up an apache vhost and point it at the docroot folder _inside_ your elgg multi install.

  11. @Marcus,
    This is awesome. Just installed on a sub-domain and works great. I’m creating sites and databases manually as not sure how to create wildcard domain on my VPS – through Kloxo;-(

    My question: can we upgrade /docroot files with latest elgg 1.7.4?
    Or will that not work?
    thanks.

  12. @Damir:

    In answer to your first question, probably not out of the box – it would have to be tested first and any modifications to the patch code would need to be made (which may be no changes at all its hard to say). I invite you to give it a try and give feedback!

    In answer to the second one, each site is its own elgg – so they visit the subdomain you’ve activated and sign on in the normal way 🙂

  13. Marcus,

    Thanks for your reply.

    I’m trying to set up testing sites for clients where they can view their themes. Right now I setup a sub-domain for each client and than I have to upload and install Elgg on each sub-domain.
    With your code I can eliminate uploading and installing core every time – huge time saver.

    As far as upgrading to 1.7.4 , I will try and mess with it and will report here my findings.
    Where is the patch code?

    Thanks.

  14. @Marcus,

    I’m trying this on my local server xampp.

    I’ve completed all the steps but I’m stuck in adding a new default Elgg domain. Could you explain a little what should i do from there on?

    I created a new domain name called localhost/elggsite1 and the database its corresponding details. But when i click to install this new domain, it just redirect me to the folder i created which is http://localhost/elggsite1/. It’s empty inside?

    What could went wrong?

    Thanks for the advice.

  15. Hey marcus,

    I just wanna know how to debug if our mulisite plugin is not installed my newly added domain….

    Please Reply me soon…

  16. Marcus,

    As I am using MultiSite Elgg, Which Has its own panel to add new subdomains.
    But when i add new subdomain in that panel. and click on install.
    It shows an error :

    Incorrect access detected, this server may be accessed only through “http://xxxxxxx.xxxxxxxxxxxxx.xxx” address, sorry.
    Please notify server administrator.

    I tried to resolve but i couldnot.

    Please help me out…

    Thanks.

  17. Hey Marcus,

    I understood the whole problem Bt I did not get the solution.
    Let me explain:

    Actually I have IIS server on which i m using Elgg multisite.
    In elgg I have admin site. From which I can add subdomain to the site i.e. :

    If admin.domain.com is my multisite admin from where I can add other subdomain like test.domain.com.
    Then my script adds the subdomain, and create Database and directory. But admin is not installing the subdomain.

    In my script I used code for dynamically create subdomain script.
    So I need to know from you. What is loop hole in my script according to you if u got understand this issue of mine..

    Please feel free to reply anytime to ask anything more regarding this issue.

    I m waiting….

  18. Hi, sorry for the slow reply, been busy!

    It sounds like you’re getting kicked back by an overzealous access restriction from mysql (i.e. the server is refusing to connect from your host as it expects an admin connection using a different hostname). You could try modifying this restriction for the multisite admin user.

  19. Hey marcus,

    I want to know something about multisite elgg.

    As I want to upgrade multisite elgg currently it is running on elgg 1.8.5 and next when I download new setup for multisite elgg it is based on elgg 1.7 according to Readme.txt file.

    will you tell that can i upgrade my multisite elgg on latest elgg version. If yes, then please tell me how?

    thanks.

Leave a Reply