22 March 2008 - 5:53pm
Drupal multi-site with different databases in cPanel/WHM
In case you have a hosting with cPanel/WHM you can have multi-site with Drupal in three simple steps:
1. Create wildcard subdomain: if you don't have root access, which is very likely to happen, request your hosting to do the following:
# vim /usr/local/apache/conf/httpd.conf
Add this:
ServerAlias *.domain.com
Then:
# vim /var/named/domain.com.db
* 14400 IN A XXX.XXX.XXX.XXX
Replace XXX.XXX.XXX.XXX with the IP of the domain (e.g. 192.168.0.1).
Now restart two services:
# service named restart
# service httpd restart
The reason I do this is to save time creating a new installation under the same site. Without this step you would have needed to create a new subdomain then modify .htaccess file, etc...
Now when you visit: foo.domain.com, bar.domain.com, they will all be handled by domain.com.
2. Now create a new database, install Drupal to ~/public_html. This is going to be the default installation.
3. Whenever you need a new installation, say "foo", you will need to create a new db for it copy "sites/default" to "sites/foo.domain.com". Make sure you create "files", "modules", "themes" folders (if you need them) inside "sites/foo.domain.com", also make sure settings.php points to the new database created for the subdomain.
References:
http://rshagrawal.blogspot.com/2008/01/how-to-create-wildcard-subdomain-on.html
http://drupal.org/node/156720
Fantastic information. I did not know this was possible (although I am a bit of a greenhorn)...
Dmitry - reply
Thankx a lot it seems i am not the only one who does not know about this , yes many people are ignorant about this , hope what you are tring to do reaches the ,masses. - reply
I found such info in other place but I was searching very long - reply
. Create wildcard subdomain: if you don't have root access, which is very likely to happen, request your hosting to do the following:
"How To create domain" - reply
Great information here!
Me too, I did not know this was possible.
Thanks for posting this :) - reply
Thanks for info. I'm working on London escorts and this info is extremely useful for me. I have only one question: where exactly should I add "ServerAlias *.domain.com" ?
Thanks in advance. - reply
drupal is the best cms for me - reply
Thanks for sharing this precious information. - reply
thanksyou to show me a better way to have multi site with different data base - reply
About Me
I am Omar.
An OpenSource enthusiast, I do Drupal contributing and service providing.
Get some more boring details here.
You may contact me for any ideas, questions or help.

Tags
Online
There are currently 0 users and 0 guests online.