Is my multi domain setup feasible?
I've got 1 master domain and 3 secondary domains. (www.domain1.com, www.domain2.com, etc). This is a family of websites that will be a user community.
I want all 4 domains to share the same users, roles, permissions, etc.
I want each site to be able to have its own themes, blocks, content, etc.
Here's how it's set up now:
1. Each domain has its own installation of Drupal, with its own database.
2. I've modified settings.php of each "secondary" domain to use the user data from the "master" domain's database. So far, it's working. (Here is the page I used to help me set this up: http://drupal.org/node/22267)
I am not making use of the sites folder to set up the multisites.
Each domain has its own admin control panel. It is 4 separate Drupal installations, with 4 separate databases. The only thing the sites have in common is shared users. I've also made it so that users can only register on the master domain, but they can login on the slave domains.
My question is, what is your opinion of this setup? Is this the best way to do it or is there a better way? Are there disadvantages I'll run into as a result of setting things up this way? Thanks!

The Holy Grail
In my opinion. Your solution is an expensive proposition in my company. I approached the boss on this idea, and they believe $15,000/year hosting fee is over the top.
I found this solution:
You want: "completely separate sites with different domain names on one apache server without virtual hosts and with one Drupal base files." The plan: create a new Drupal at http://www.mysite.com/newsite that functions off the codebase of www.mysite.com/drupal (the new Drupal can share themes and modules with the original one) but no user could ever tell that this is the case; they function like two completely different sites with different log-ins, themes, etc.
--
Assuming you have a functional Drupal site at this address: http://www.mysite.com/drupal
Assuming you have ftp and shell (SSH) access to your server.
Assuming you have some way to create/manipulate mySQL databases on that server (aka PHPmyAdmin)
--
Create a new Drupal mySQL database (either a brand-new one, or a second set of tables with a prefix on an old one, as described here.)
Create a user who has privileges to this database or assign local privileges to an existing user.
.
FTP to your server.
In www.mysite.com/drupal/sites create a new folder named www.mysite.com.newsite
Make a copy of the settings.php file from mysite/drupal/sites/default.
Edit this new settings.php file to reflect your new database and user, and put it into the www.mysite.com.newsite folder
Create a new folder in www.mysite.com.newsite called files. If you will be doing a lot of customization, also create folders called themes and modules in www.mysite.com.newsite - Drupal will look here first before using the global ones from www.mysite.com/drupal.
.
Now, SSH to www.mysite.com (using Terminal on Mac or puTTY on Windows) with this command:
ssh www.mysite.com
Log in to the server with name/passwd.
Assuming that your drupal at www.mysite.com/drupal is in htdocs (check with FTP to see exactly where it lives), go there with this command:
cd /usr/local/apache/htdocs
Your cursor prompt should now say [yourname@mysite htdocs]
Now create a symbolic link to newsite from www.mysite.com/drupal with this command:
ln -s drupal newsite
where drupal=your original drupal folder name and newsite=your new site folder name.
You won't get any confirmation, just a new cursor prompt. Log off or first open a browser to see if it worked.
.
In a browser, navigate to www.mysite.com/newsite and register yourself as first user.
In administer > settings > File system settings, make sure the file path is set to:
sites/www.mysite.com.newsite/files. This makes sure that all your media content will be stored in one discrete place within your subsite (not in the global files folder on www.mysite.com/drupal) should you ever archive or move this drupal site elsewhere.
*posted with no guarantee or particular techie skills; this did work for me*
I do not have shell access, so still working on this issue
Thanks for your reply
Thanks for your reply but...I don't understand what you mean by $15,000 a year hosting fee? My host doesn't charge anywhere near that amount. How is my setup an expensive proposition? Can you please clarify for me! Thanks.
Thanks also for your solution, but it doesn't apply to me because I am using different domain names (eg. www.domain1.com, www.domain2.com, www.domain3.com and www.domain4.com), whereas the solution you posted uses subfolders. Also I don't have SSH access to my server, unfortunately.
Holy Grail - stuck near the end!
Thank you for your detailed instructions. They have been quite easy to follow. However, I am hung up on one part...
I have Drupal installed in www.mysite.com, and I want to also use it in www.mysite.com/newsite (with different themes, etc.). I am planning to use a separate database for newsite -- there is no crossover with the main site.
I got all the way to creating the symbolic directory, which seemed to work (I did not get an error message). However, when I navigated to www.mysite.com/newsite, I got "Page not found". I ran cron and that did not help.
I assume in settings.php, I should set the base_url to www.mysite.com/newsite. I am not sure where to go from here... any suggestions?
Getting closer
I found this article to be helpful:
http://www.contractwebdevelopment.com/drupal-multisite-configurations-an...
By deleting the "newsite" folder, and then running
ln -s . newsiteI am now able to get newsite functioning.However, I am now unable to change themes on newsite. I will look for that solution elsewhere.
I was actually able to get a
I was actually able to get a seperate, themed folder to work long ago just by editing one core file. The way I understand it the file is written the way it is because of Windows servers, but it worked on Apache. This was several Drupal versions back but I found the instructions by searching for multisite here on the forums.
The format I ended up with was domain.com/folder not folder.domain.com if that matters to you.
I am using domain.com/folder
I am using domain.com/folder -- it is for the site located in "folder" that I cannot get themes to work. All of the themes I installed show up in Administer/Site building/Themes, but when I select any theme other than the first one to be default, it continues to revert back to the first theme in the list.
Ok I've tried the /sites folder...
Ok, I've tried using the /sites folder method, but I can't get the symlinks to work. So it looks like I'm stuck with the multiple installs/shared tables method. I don't really mind this, as I've got the table sharing working well. I've also managed to share the "boxes" and blocks permissions tables, that allows block content and permissions to be shared throughout each site, but the block visibility/position can change per site.
The only thing I'm worried about is possible problems I could face in the future as a result of sticking with this method. For example, would upgrading the site be a nightmare? As far as backing up goes, I would just need to back up 4 databases and the 4 settings.php files...right? Thanks for any insight!!
Just use the www.domainname.com instead
Just use the www.mysite.com instead of www.mysite.com/newsite
as for the backups:
The best advice is to use a hosting provider that permits SSH ....Dreamhost..or HostGator or Dathorn that grants SSH privileges and use this script...http://drupal.org/node/113229
It can be used with a cron job or I think it can be triggered inside a php statement...someone weigh in here.
---------------
Russell Griechen
Thanks. I can't change my
Thanks. I can't change my hosting provider at this point though. I do have the ability to run cron jobs, so I might still be able to use the script. Thanks for posting it!
The way I understand it, the
The way I understand it, the main problem with the seperate install method is at upgrade time. You have to upload the new version for each of the sites and if they use many of the same contributed modules, your efforts are multiplied accordingly. On the other hand, if you wanted to upgrade to say, 5.0 but one of the sites used modules only available for 4.7 you could still upgrade the others. May be a plus!
The thing that works for me is to have domain.com with a nice Drupal setup using the default folder. I can then park domain2.com on top of that and I get the exact same website using either domain. To get a different website for domain2.com all I have to do is to have the file pointing to the different database in a domain2.com folder. No symlinks, nothing.
You need the symlinks for a subdomain.
Here's the way I did
Here's the way I did it.
http://drupal.org/node/131036
Multi-site setup, using subdomains and symbolic links
My multi-setup is this...
• I have one functional Drupal 5.1 installation for my main domain (www.mydomain.com/drupal51)
• I have various separate Drupal websites using the sites directory, each with their own database
• The different Drupal websites run at their own subdomains, like blog.mydomain.com, laotze.mydomain.com
• I am using symbolic links, not through shell (doesn't recognize "ln"-command) but either through a) php script b) ftp/scp
• I have no access to Apache's httpd.conf
So, if you have ftp access and the ability to create subdomains with your ISP, perhaps this may work too...
1) I created the subdomains though my hosting provider's control panel
Then my directory setup looked like this..
/www/www.mydomain.com/drupal51 (my Drupal install)
/www/blog.mydomain.com/ (directory, contained only a landing page)
/www/laotze.mydomain.com/ (directory, contained only a landing page)
The /www directory is the root of what's accessible to me. When entering my domain in the browser, it will look into the /www/www.mydomain.com directory for anything it can serve.
2) I created the appropriate sites directories inside the Drupal sites directory. So I had this...
/www/www.mydomain.com/drupal51/sites/www.mydomain.com
/www/www.mydomain.com/drupal51/sites/blog.mydomain.com
/www/www.mydomain.com/drupal51/sites/laotze.mydomain.com
3) I created the mySQL databases through my hosting providers control panel, using different names and passwords for each database. It might be a good idea to create a user 'admin' for all of the databases. You then only have to remember the passwords, but obviously you can do what feels right. Also it might be helpful to pick a name for the database that corresponds with the subdomain/website. For example: blogdb for the blog.mydomain.com website, etc...
4) I copied settings.php from /www/www.mydomain.com/drupal51/sites/default into each of the sites directories, created in step 2 and made the proper changes to each settings.php file. For me, only the $db_url = 'mysql://usr:pass@localhost/dbname'; line needed to be changed. I assume here that you know how to change each settings.php file. It is documented on this site, so please refer to the handbooks to check if you don't know what I am talking about here.
5) I then deleted all the directories that were created by my hosting provider, when I created the subdomains using WinSCP. SCP is similar to FTP. Works the same. WinSCP is a very small but powerful SCP client that allows you to do the same as with FTP, but FTP will do just fine. Get the latest version here... http://winscp.net/eng/index.php
6) I created symbolic links to the drupal install. I know there are many threads on this, because I have read them all :-)
I tried the "ln -s" command in SSH shell, but it was not recognized. Either my hosting provider is running a very slim version of its OS, or the number of commands are restricted (most likely the latter).
a) I tried using the PHP for creating a symbolic link. I created an empty document in notepad, and pasted in the following...
<?phpsymlink ('/home/username/www',
'/home/username/www/blog.mydomain.com');
?>
I uploaded this document as createlink.php to /www/www.mydomain.com/, where it's accessible to me from the web and typed in a browser: http://www.mydomain.com/createlink.php.
When I got a white page, I entered blog.mydomain.com and I reached the Drupal welcome page, containing the Drupal steps needed when you first go to your Drupal install.
I changed createlink.php for laotze.mydomain.nl and repeated the process.
I checked using WinSCP and noticed the symbolic links, much the same as shortcuts to folders on your Windows desktop. So now I had this...
/www/www.mydomain.com/drupal51 (my Drupal install)
/www/blog.mydomain.com/ (symbolic link)
/www/laotze.mydomain.com/ (symbolic link)
b) I noticed WinSCP supports creating symbolic links, under right-click, New (ALT+F6). This is probably much easier, even when you don't have access to "ln" from a SSH shell.
In depth details on how to create (and remove) symbolic links using PHP is described here...
http://www.ideasfornet.com/how_to_create_symbolic_links_without_shell_ac...
http://www.contractwebdevelopment.com/drupal-multisite-configurations-an...
I am pretty sure there are a dozen ways of setting up multi-domain Drupal environments, but hopefully this helps someone.