ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

MSM Setup with 2 domains

May 24, 2011 10:04am

Subscribe [3]
  • #1 / May 24, 2011 10:04am

    Jacek Sompel

    15 posts

    I had been trying to find through the EE Wiki and the EE Forums some sort of detailed information on how to setup 2 EE2 domains with MSM (Multiple Site Manager).

    Information on the http://ellislab.com/expressionengine/user-guide//cp/sites/domainsetup.html is simply too generic and too incomplete and I am sure I am not the only one that had issue with setting up MSM following instructions from that page.

    So here is a bit of a background of what I have:

    - Plesk VPS
    - 2 domains: lets say domain1.com and domain2.com
    - The first (default) domain was set up along with MSM 2 and is fully functional
    - domain2.com was set up as an alias of domain1.com
    - domain2.com was set up in MSM and all the data and templates were imported
    - change was mage to domain2.com site/index to distinguish that it’s different

    The issue is domain2.com is displaying the same information that domain1.com is. I’ve read in numerous forum posts about MSM and some of the methods various people used, however none were detailed enough to explained how to set up 2 or more sites with MSM.

    Here are my questions.

    1. Can EE2/MSM be setup using domain aliases? If yes then how should this be set up from the file system perspective? Copying index.php/config.php, adding mod_rewrite rules?
    2. Would setting up 2 separate domains (non aliased) be a better way? I understand that will most likely cause issues with open_basedir but I am sure I can work my way around it.

    Can someone please explain the correct method of setting up 2 or more domains with MSM.

    Thanks,
    Jacek

  • #2 / May 24, 2011 3:36pm

    Brandon Jones

    5500 posts

    Hi Jacek, and welcome to the forums!

    I don’t think domain aliases will work, as when your webserver is responding to requests for domain2.com it is still calling the files from domain1.com. MSM is designed to be used across two or more “true” (virtual) hosts. Give that a try and let us know if that works!

  • #3 / May 24, 2011 10:20pm

    Jacek Sompel

    15 posts

    Hi Brandon,

    I need some explanation on what is the correct/best way to set it up.
    As I mentioned I am running a Plesk VPS and because this is the latest version of Plesk few things have changed in the way Plesk allows you to create domain paths on the server.

    I managed to reconfigure my setup to the following setup:

    /httpdocs/domain1.com
    /httpdocs/domain2.com

    Domain1.com contains the full EE2 site, domain2.com just contains the index.php that was copied from domain1.com.
    I’ve modified the index.php and changed the following:

      $system_path = ‘../domain1.com/system’;
      $assign_to_config[‘site_name’] = ‘domain2’;

    Having this set and trying to open the domain2.com in the browser results in EE generates 500 error is headers and nothing is being displayed.

    I am just a bit unsure how this MSM setup is mean to actually be set up from the file system perspective.

    1. Option 1: Should I leave the system themes images folders in /httpdocs folder and configure individual index.php inside /httpdocs/domain1.com and /httpdocs/domain2.com respectively?

    2. Option 2: Should I keep all the system themes images folders in /httpdocs/domain1.com and only configure index.php for domain2.com inside the /httpdocs/domain2.com folder?

    3. How will the site manager be able to login to the CP from domain2.com.

    There is nothing in the documentation that actually explains different scenarios of how to set this up.

    Your help would be greatly appreciated.

    Jacek

  • #4 / May 25, 2011 1:55pm

    Shawn Dai

    76 posts

    Jacek, did you set these as well in domain2.com/index.php:

    $assign_to_config['cp_url'] = 'http://domain1.com/system/index.php';
    $assign_to_config['site_url'] = 'http://domain2.com/';

    I’ve done “Option 2” of what you described. It should work ok with your file system setup.

    To login to the control panel from domain2.com, use control panel masking.

    Also, this thread may be helpful in getting your files setup.

  • #5 / May 25, 2011 5:18pm

    Brandon Jones

    5500 posts

    Thanks Shawn.

    jaceks, yes, both scenarios you outlined are valid, and what you have sounds like it would work. A 500 error is usually indicative of something else going on, so check your error logs for more clues.

  • #6 / Jun 28, 2011 3:09am

    Jacek Sompel

    15 posts

    Hi,

    First of all thanks for your responses and apologies for not responding any earlier.

    I ended up working out how to set it all up and everything seems to be running as it should be.
    The only thing I couldn’t work out was the themes folder which I ended up duplicating as I couldn’t figure out how to share it between the 2 sites.

    What I ended up having was the following:

    /var/www/vhosts/client.com/httpdocs/domain1
    /var/www/vhosts/client.com/httpdocs/domain2
    /var/www/vhosts/client.com/httpdocs/system
    Note 1: httpdocs folder is no longer mapped to any web access as each individual domain web root is mapped above the httpdocs.
    Note 2: since I set this up on Plesk 10 there are no isses with open_basedir as both domains are owned by the same user.

    Each site was customised with masked admin (admin.php)
    As I said the only thing I had to duplicate was the themes folder which contained all the regular EE folders and third_party folders/files.
    Each individual site index.php was customised with:

    Domain 1:
    $assign_to_config[‘site_name’] = ‘default_site’;
    $assign_to_config[‘cp_url’] = ‘http://www,domain1.com/admin.php’;
    $assign_to_config[‘site_url’] = ‘http://www.domain1.com/’;

    Domain 2:
    $assign_to_config[‘site_name’] = ‘domain2_site’;
    $assign_to_config[‘cp_url’] = ‘http://www,domain2.com/admin.php’;
    $assign_to_config[‘site_url’] = ‘http://www.domain2.com/’;

    The only other folder I had to duplicate min folder (NSM Minify) and correct the config file to point to correct paths.

    So there it is, hope this will help someone else.

    Jacek

  • #7 / Jun 28, 2011 8:50pm

    Lisa Wess

    20502 posts

    Hi, jaceks -

    Glad you got it working!

    Sharing the themes folder should be as simple as calling the correct path and URL on each site.  However, you may not want to do this, especially if you theme the sites differently for members, forums, wiki, etc.

    If you do have any other questions, please start a new thread and we’ll be happy to help out!

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases