By radhika.w on
Hi...
I have installed drupal 6.8 and its working fine with no problems at all. However, now I am into a scenario where I want to host multiple sites with different databases, different content but the same codebase.
I know i can do it by juts extracting a drupal tar file and re-installing stuff again..But this would be my worst case situation. I want to do it using the multiple site flexibility.
I am a newbie when it comes to setting up virtual hosts. I am using openSUSE 11.1
thanks in advance!
Radhika
Comments
Multi-site setup
Are you using a hosting control panel (e.g. Cpanel, Plesk, etc)? Or are you managing virtual hosts in your httpd.conf by hand?
If by hand, then here's a sample which may help...
Site 1:
Site 2:
The key thing to notice is that the domain of site2 is pointing to the same path on the server as site1 (and that is the path where Drupal is actually installed). When Drupal loads it reads the site's address and if it matches one of your multi-sites, loads the appropriate site. In your sites directory, you will have www.site1.com and www.site2.com folders, in which both have settings.php files that point to separate databases. If you want some of your modules/themes shared by both sites (makes maintenance much easier) then put them in sites/all. You can put modules/themes that are specific only to one site or the other inside that site's own folder, e.g. sites/www.site1.com/modules. After you edit and save httpd.conf, make sure to restart the Apache (httpd) service for changes to take effect.
Hope this helps.
-- David
davidnewkerk.com | absolutecross.com
View my Drupal lessons & guides
same content displayed
Hey many thanks for the prompt reply.. !
But like I have mentioned earlier... I am using openSUSE, so the virtual host configuration is supposed to be done under /etc/apache2/vhosts.d/dummy-host.conf file
So i did that, the name of my site is "intranet" thats it .. (on localhost)
And now my intranet.conf file looks like this:
I have all the configurations set under sites/intranet/settings.php with correct dbname, etc.
However, when i do this on my browser url: localhost/intranet, I do see a drupal page - but with the same content as my earlier managed site. And when i go back to the original site which is localhost/drupal. I again see the same content.. But in both the cases, some of my primary links do not display any data..!!..
So here, it is m back to square one.. this is exactly what was happening with me earlier also .. Can you tell me what extra should i do to separate the contents in there?!?!?
thanks,
Radhika
Some ideas
Hm I haven't tried multi-sites on a localhost before (though I just did it tonight to confirm). My guess is Drupal is unable to make use of that localhost path to correctly determine the proper multi-site to display. However, I find the best way (and which will likely solve your problem) is to set up actual local virtual host domains for each Drupal site, which is very simple (takes just a moment for me). The way I do that is:
Entry in my httpd.conf (provided by MAMP on my local server in this case):
The .dev is not needed but I add it to make it better simulate the look/feel of a real domain.
Then using sudo I add an entry to /etc/hosts
I can then access the site in my browser as if it were a real domain, http://site1.dev and Drupal behaves like it is a real domain as well.
The IP is the standard localhost IP, so I think that "should" work.
After these settings, restart apache, and you might have to flush the DNS cache.
I believe if you set this up, Drupal will be able to serve the correct multi-sites.
May be helpful: http://drupal.org/node/167639
One aspect I'm not 100% positive on yet is how sites/sitename/files directories may be affected when moving the multi-sites from localhost to a live server (since my understanding is that changing the file directory path after the fact could cause issues, though I think only if there are hard-coded file paths in content). I will look into that and get back to you. There may be a better way, but my initial suggestion would be to create a sites/realdomain.com folder (settings.php inside), and make a symlink
ln -s realdomain.com site1.dev. Then after Drupal is installed, adjust the File system path to sites/realdomain.com/files before uploading anything. This will allow your multi-site to work locally because Drupal will see site1.dev. Yet Drupal will store file paths under realdomain.com. When you upload the site to the real server, the file path will already be correct. Of course you could also just set your hosts file to tell your computer that realdomain.com is on your local system in the first place (so long as you don't need to access the online domain during development). I don't know if this will have other side effects yet, but it seems to work. I'll let you know if I find a better way.-- David
davidnewkerk.com | absolutecross.com
View my Drupal lessons & guides
thanks i will try
Thanks Thanks a million for the prompt and such a descriptive reply.. I will try that at the earliest and let you know..
Thanks again :)
Radhika