I'm reading a lot about Drupal, and so I've read about the multi-site installation option.
They explain there that you should put everything in the sites folder and use correct folder names, for example http://www.example.com:8080/ could be loaded from sites/8080.www.example.com/.

But I don't understand how to configure this in Apache or IIS.
Can I just assign every hostname to the root folder and will Drupal take care of everything?

Comments

I can only speak for Apache as that is what I use.
You should look into the VirtualHost directive - see http://httpd.apache.org

The you specify both port and DocumentRoot. Once that is correctly setup Drupal will take care of the rest.

I know how to configure an Apache or IIS, but should I direct all the hostnames for my drupal sites to the same root directory?
Does Drupal handle all the rest?

I am doing this with my webhost and I point all of my domains to the same folder and drupal out of the box figures out what to do with the sites folder.

Joe Moraca
http://www.moraca.org

Joe Moraca
http://webdevgeeks.com
White Springs FL

Yes. You are using the same core files after all. All the magic happens through the configuration and the fact you are using seperate databases.

So mysite.example.com and yoursite.example.com both point to /webserver/root/sites/.
You place your modules inside the Drupal /sites/all/modules directory to make them available both on yoursite.example.com and mysite.example.com.

Configuration of the sites (and modules) happens individually as they both run from a different db.

Thanks guys for the quick responses !

In my book link below, there is a step-by-step set up for multiple sites.

Nancy W.
now running 5 sites on Drupal so far
Drupal Cookbook (for New Drupallers)
Adding Hidden Site Design Notes

Do you have access to a control panel? If so, you can save yourself the bother of editing httpd.conf/configuring Apache etc by simply parking the secondary domains on the main domain holding the drupal codebase.

Easy multisite using cPanel:

  1. Install drupal codebase in the webroot of the main domain, with its own db.
  2. Login to the cpanel interface for this main domain, click on 'Parked domains' and add the secondary domain for which you want to run a drupal based site.

    By parking the domain for your second site (if it is a top level domain, it should have been registered, if it is a subdomain, then it's fine) on the main domain, you are creating a server alias that points to the same document root- the drupal codebase. This steps automatically configures httpd.conf for you.

  3. Click on the Mysql databases link in the main domain's cPanel interface and do the following:
    -Create a db for the second site
    -Create a db user for the second site
    -Grant this db user all privileges to the db you just created
  4. Through command line or through an FTP program, create a directory (folder) within the 'sites' directory of your drupal install that corresponds to the second site you want to create- let's call this directory secondsite.org
  5. Copy the settings.php of the main domain and put it inside the secondsite.org directory.
  6. For good measure, also create a 'files' directory and 'tmp' directory within the secondsite.org directory
  7. Run www.secondsite.org in your browser, enter the db details you created in Step 3 and finish the db configuration process for drupal for your new site
  8. Repeat steps 3-7 for every other site you want to run off the codebase you installed in the first domain.

Notes:

  • Most important
    If you use cPanel to create drupal multi-site, DO NOT create the secondary sites as separate accounts in WHM (Web Host Manager). You just need to create one account for the main domain.
  • Assumptions:
    - You are running drupal 5.0 and above;
    - You have access to cPanel for your domain;
    - Adding parked domains is configured in your cpanel
    - You can create multiple databases
    - You are running the additional sites from their web root and not from subdirectories
  • If you have completed the setup and database configuration of your first site, in Step 5, remember to remove the site-specific db details from settings.php after you have copied it to the secondsite.org directory. In other words, settings.php in each new site you create should be the pristine, unedited file that ships with drupal. The automatic drupal installer process will trip up if this file contains any db values. There is a workaround, but it can be confusing.
  • Depending on how your server is setup, you may need to change the permission for settings.php to 777 to make the automatic installer work. Remember to set it back to a more secure permission after you are through with the site setup. I found that it was better to do this after creating the first account and setting up the file system settings, but your case may be different.
  • Creating multi-site in a sub-domain: If you are setting up the multi-site on a sub-domain of the main domain, first create the sub-domain using the 'Sub domains' link in your main site's cPanel interface and then follow from Step 2 above to park this sub-domain on your main domain

----
Previously user Ramdak.

This sounds very close to the problem I am having. I am a new user to drupal. Just installed Drupal 5.1 (via Fantastico on BlueHost). I installed it on both the main domain and and an add-on domain. The main domain is fine. The add-on domain is fine if accessed via http://www.maindomain.org/add-on/. However, if I access it via http://www.add-on.org/, I get all the correct content but absolutely no theme material (no colors, no images, etc). The theme is Garland and appears just fine if accessed via the www.maindomain.org/add-on.

Given that all the content is showing up in both cases, I am assuming that the database situation is fine. Given that the theme will show up if accessed via the maindomain, I am assuming the theme structure is fine. Which makes me think that I should be doing something with the settings.php file in the default folder inside the sites folder of the add-on folder. But when I tried explicitly setting the default theme in that file, I broke it. I guess I should add that I did a second Fantastico install of Drupal for the add-on site. I installed it into a folder named the same as the add-on domain. Perhaps that was my mistake.

I checked the troubleshooting guides but didn't see anything applicable. However, it is now 3:41 AM so I might have missed it.

Thoughts? (And advanced thank you for any help).

That's really funny... no reply for so long... what is the answer, by the way?

-------------------------
My first professional Drupal Site: http://www.WiseEarthPublishers.com. Also happens to be my own company! :)
Running a programming challenge with €1000 prize! http://www.WiseEarthTechnology.com

I believe this is because you installed Drupal directly in the root which will affect all domains. By root i mean your public_html.
when you add-on other domains their root would be public_html/add-on or public_html/add-on.tld since they updated to cpanel 11. With this schema the .htaccess in the root is controled by Drupal and Drupal is seeing the add-on as part of the origional. so, even though you have an install in the directy for your add-on when you address without the www. you are not actually going to it you are going to the drupal install at the root-domain. How you are connected to the right database is beyond me.

Now why it works when you use the www. This is because of the setting in http.conf or in .htaccess. Because the first domain knows it is at http://yoursite.com and not at the alias of www.yoursite.com it treats all request without the www. as belonging to it. So, when you go to www.your-second-site.com the Drupal code installed on the root is bypassed and now you are running from the actuall Fantastico install for your-second-site.com. Hope that makes sense.

The fix depends on whether you wan't drupal and non drupal sites hosted on that account.

to have both with the primary domain running Drupal you need to do what I did on my Hostmonster account I installed Drupal in a sub_folder. (not a sub-domain, although you could use a sub.domain) so my path was "/home/username/public_html/Drupal" and I have a .htaccess
"
Options +FollowSymlinks
RewriteEngine on
#This would be for your primary domain.
RewriteCond %{HTTP_HOST} ^mydomain.com?$ [OR]
RewriteCond %{HTTP_HOST} ^www.mydomain.com?$
RewriteRule ^(.*)$ http://mydomain.com/Drupal/ [R=301,L]
"

Setup this way I am able to have add-on and sub-domains resolve correctly.

BTW- If you are going to use Drupal for multiple domains why keep installing? just use cpanel and setup new domains as parked instead of add-on and follow the multi-site install proceedure. I know that setting up each new domain is a little more work because you have to create directories. and copy the config.php then edit it with settings for your database. But it is not hard.

I have been struggling with this for a month now. Very good stuff!!!

http://jamesdeer.net
http://textslayer.com

Hi folks,

I am new to Drupal and I want to ask you whether I am correct what you said about these intranet multisites.

/root/
/root/site1/
/root/site1/subsite1/
/root/site1/subsite2/
/root/site1/subsite3/
/root/site1/subsite4/
/root/site2/
/root/site2/subsite1/
/root/site2/subsite2/
/root/site2/subsite3/
/root/etcetcetc

How can I make it possible? Configure httpd and create new db names for these intranet sites?

Thanks!

DJH

I believe the reference to root site is the path to the root site. Root site being the first domain you set Drupal up in. for example on my hosted domain at BlueHost the root was;
/home/user/public_html/

you need to point your sub.domain back to the root. NOT Linux Root but the root for the first site. And for Sub.domains according the the Multisite install instructions you will need to use symbolic link to point the sub. to the site root.

As far as the directory setup inside of Drupal (meaning the location of the drupal files) you should already have sites/
so, for each new site or sub.site you would have the following dir path assuming your Drupal is NOT already in a sub folder.

~/public_html/sites/default |this is where the config.php file is. now create a new directory under sites/ with the name for your new domain or sub.domain. Some examples...
~/public_html/sites/sub.domain.com
~/public_html/sites/newdomain.com
~/public_html/sites/sub.newdomain.com
~/public_html/sites/another-domain.com:8080

This is not conclusive. You will still need to follow Multi-site instructions concerning database setup and editing config.php.

you have:
~/public_html/sites/another-domain.com:8080

do you mean to imply that we can specify which ports drupal will respond to? Or do we need to specify the 8080 port for it to work properly?

thanks...

-------------------------
My first professional Drupal Site: http://www.WiseEarthPublishers.com. Also happens to be my own company! :)
Running a programming challenge with €1000 prize! http://www.WiseEarthTechnology.com

Some hosts require Drupal to respond to a non-standard port address. For those cases, you may specify the port. The vast majority of sites do not need this. If you don't, the best thing is to leave it off.

Nancy W.
Drupal Cookbook (for New Drupallers)
Adding Hidden Design or How To notes in your database

Hi,
I'm newbie. Aready created a few articles. My question, sounds simple but already a week cannot find solution: The default front page is fine. From there I''m creating links to totally unique 'front page' for each 3 unique sub-websites (independent sub-domain?). Problem is..if I use the create article or basic page, the same default frontpage image header & title automatically displayed; i.e. all page created is truly content page. Also, 'Home' link will appear, I do not want this link-back to drupal default frontpage. Hope someone can help. TQ.