In recent weeks I have been working with a friend setting up a web site/web service as a business idea. We decided on
Drupal as a base for the project due to it's apparent adaptability to multisite configuration, meaning, one code base can run multiple web sites. First we tried it on the
DirectAdmin control panel, as it's my personal choice. It turns out DirectAdmin has some limitations when running subdomains that disallowed it from working in our desired setup.
So, off to
cPanel we go...
I haven't looked at cPanel is years, it's come a long way, and has good addon domain handling as well as very functional subdomain handling, and it's user interface has become vastly more usable, though it still has too much crap on top with all the useful links available after scrolling.
The trick for multisite handling is that you need to assign all your domains and subdomains to point to the same web root. When registering a new subdomain, point it to the default "public_html" directory of your web root. When registering an addon domain, you must declare it as a "parked" domain. As a parked domain you have no ability within cPanel to use it for email, however, so one would need to go to the registrar and direct the email to Google Apps or some such service.
That takes care of the domain pointers. Now it's handling them inside of the Drupal system. Drupal has a root/sites/ directory. Inside that directory you need to creat a directory for each domain and subdomain you will be running. So your install will look like this (assuming "public_html" is your web root, some hosts use "htmldocs" or any other name):
/public_html/
/public_html/sites/
/public_html/sites/default
/public_html/sites/domain1.com
/public_html/sites/domain2.com
/public_html/sites/subdomain.domain1.com
etc.
Each of those directories will be used when Drupal is hit with a request from the related domain. The trick to a multisite configuration is to never, ever use default for anything! Always, even from the very first domain, use a domain folder. The sites/default folder has a file in it named "default.settings.php". This file should be copied to each domain folder and renamed settings.php and made writable for installation, also make sure you have a unique database for each site to keep each site separate.
You can use one database a use a prefix, but that would be a HUGE database if you are running many sites, using a unique database helps keep sites independent, and database sizes more manageable.
Any domain or subdomain that is requested from a domain folder that hasn't been set up will be prompted to install it. The install works the same for any domain or subdomain, just enter the proper database info for each one.
These are just a few tips I have learned in the past few weeks to make running a multisite configuration of Drupal easy.