You want petermoulding.biz, cjm.net.au, and unlevelhome.com on the same server, or virtual private server, using one copy of Drupal and a separate database for each site. You are using Cpanel. The first site will take whatever time you need to upload and install Drupal. The second and subsequent sites will take 5 minutes each. This example uses Drupal 6. Drupal 7 appears to be the same.
Drupal 6 and 7
The cPanel part of this page is the same for Drupal 6 and Drupal 7. I use exactly the same procedure for Drupal 7 multisite. Please add a comment if you do find a difference for Drupal 7 or a new release of cPanel.
- First site
- Second site
- Third site
- Update notifications
- Which site goes first?
- cPanel interface
- Drupal in a subdirectory
- Drupal lookup documentation
- SSL certificates for multiple sites
I assume you have the first site set up. You used WHM to create a database account for petermoulding.biz then went into Cpanel for petermoulding.biz to set up email and install Drupal. You now have petermoulding.biz working with Drupal 6.
When you created petermoulding.biz, you created a user for the account and I will assume the user is named pb. Use the MySQL Databases option or the wizard. I use the MySQL Databases option. You create a database named drupal and cpanel shows a database named pb_drupal. You create a user named drupal for the database and Cpanel displays user pb_drupal. You then connect user pb_drupal to database pb_drupal with all privileges.
You use the Cpanel Email Accounts page to create some email accounts for petermoulding.biz including one named boss. You will use boss (at) petermoulding.biz as the email address when you create the administration account during the Drupal installation.
When installing Drupal, you create directories /sites/default/ and /sites/default/files/ plus file /sites/default/settings.php. You set the permissions to 777 then run the installation step then set /sites/default/settings.php back to 644. You will repeat this step once for each new site.
Go into Cpanel on petermoulding.biz and park domain cjm.net.au on petermoulding.biz. While you are there, park unlevelhome.com on petermoulding.biz. If you run into a limit on the number of parked domains, you can go back into WHM to increase the limit. You want a database per domain so while in WHM, increase the limit on the number of databases.
Create a database and database user for cjm.net.au, perhaps user pb_cjm connected to database pb_cjm. Repeate for unlevelhome.com with user pb_unlevel connected to database pb_unlevel.
Go into Email Accounts and create boss (at) cjm.net.au plus boss (at) unlevelhome.com.
You probably used FTP to upload Drupal 6 to petermoulding.biz. I will assume FTP. There is a file manger in Cpanel that does similar things to Filezilla and other FTP programs. Go into /sites/ and create directory cjm.net.au. While in /sites/, create directory unlevelhome.com.
Create directories /sites/cjm.net.au/files/ and /sites/unlevelhome.com/files/ with permission 777.
Copy /sites/default/default.settings.php to /sites/cjm.net.au/ and rename the file to settings.php then give it permission 777. Copy /sites/default/default.settings.php to /sites/unlevelhome.com/ and rename the file to settings.php then give it permission 777.
Do you notice how you are repeating part of the original installation? Yeah, it gets boring if you have 2000 sites.
Visit http://cjm.net.au/ and up pops the Drupal 6 installation process, exactly the same as happened with petermoulding.biz. Answer the same questions. Use the right database name, database user name, and password.
Visit http://unlevelhome.com/ and up pops the Drupal 6 installation process, exactly the same as for petermoulding.biz and cjm.net.au.
Done! You could do ten at a time if you can keep track of all the passwords. Replace your Drupal Beginner t-shirt with the Drupal Do It In My Sleep t-shirt.
Put standard themes in /sites/all/themes/ to let every site use the themes. Site specific custom themes go in a /themes/ directory within the site. A cjm theme would go in /sites/cjm.net.au/themes/ as /sites/cjm.net.au/themes/cjm/.
You have a separate database for every site so you can activate different modules for each site. Put the modules in /sites/all/modules/ then let each site switch them on or off.
Drupal automatically checks for code updates unless you turn off update notifications. You have only one copy of the code so switch off update notifications for all sites after the first.
Ok, darumaki pointed out the case where different sites use different modules.
This might be fine if every site was using the same modules, however, a typical multi-site setup usually involves each site using different modules, therefore, it should not be advised to turn off updates on the other sites, because updates only checks the modules that are enabled and not all the modules in the module directory. You could turn on every single module in your base domain, to get update notifications, or you could turn on updates in just those domains with something different.
The same consideration applies to themes because theme updates are detected and notified the same as module updates. The main saving from turning off updates is when you set up 3550 identical sites for the 3550 members of a professional association. They want separate databases for client privacy but they all get the same modules and features as specified by their association.
You have one copy of the code so put all the sites offline before updating the code. You have a database for every site so run update.php on every site before switching the sites back online.
Which site goes first?
The first site is locked in place while any other sites are parked on top. Use a throwaway site for the first site. When I registered petermoulding.com, I registered the .biz and some other variations for experiments. I used the .biz domain name as the base site for the multisite setup because the .biz domain name will not be visited by anyone but me. Each time I load a new theme into /sites/all/themes/, I can activate it in petermoulding.biz for testing. When one of the added on sites becomes to busy for the server, I can move the added on site without disturbing the other sites.
The first site is also the default site your customers will see when there is a setup failure in Drupal or Apache. Put contact information on the first site so people can report failed Web sites.
Cpanel provides several themes and each theme shows different combinations of buttons. I use crimson_smoke for these screen shots.
Go to the domains section to park your new domain, unlevelhome.com, to your existing domain, petermoulding.biz. Do not use Subdomain or Addon domain for this part of the setup.
You add subdomains in the form x.example.com. For domain unlevelhome.com, you might add forums.unlevelhome.com and shop.unlevelhome.com. First you would park unlevelhome.com on petermoulding.biz and create unlevelhome.com in Drupal following the instructions on this page then you would look at adding forums and shop to unlevelhome.com. Adding subdomains should be covered in another page because there would be considerations around sharing user ids across the domains.
The following image shows the Cpanel subdomain page. You can add, edit, and delete subdomains. If you leave the document root field empty, the result will be similar to parking a domain and should let you use multisite. Multisiting forums.unlevelhome.com next to unlevelhome.com would require public_html/sites/forums.unlevelhome.com/settings.php, another database, and a way to share the login.
Addon domains are similar to parked domains but add more complications. Do not use Addon domains for the procedure in this page, use Parked domains.
The following image shows the Cpanel domain addon page. Notice the password field. Addon domains have a subaccount type arrangement you might use if you want to delegate administration to someone else. You could put several domains in one WHM account using separate subdirectories and give each site administrator separate FTP access. The separate FTP access does not work with multisite because they all share the same directories. Instead use Parked domains and control uploading of files using a Drupal module.
If you insist on using Addon domains instead of Parked domains then set Docuement root to public_html/. Drupal multisite is based on all page requests from all sites going to the same public_html/index.php.
You can park domain egjhnbhniu.com on example.com and Drupal can separate the two if they have separate multisite settings. You use Parked domains without redirection. A request for egjhnbhniu.com/food/turnip goes to public_html/index.php then Drupal looks for public_html/sites/egjhnbhniu.com/settings.php and uses the database from the settings file. If public_html/sites/egjhnbhniu.com/settings.php is missing, Drupal uses public_html/sites/defaults/settings.php and you see a page from example.com.
The following image shows the simple Cpanel domain parking page. It is simple because their are no passwords or document root settings. This is all you need for multisite.
A redirect sends one domain to somewhere on another domain. egjhnbhniu.com could be redirected to example.com/test-sites/egjhnbhniu/. A common use is for personal Web sites. You create example.com/~george then, for your birthday, grandma buys george.com for you. You can redirect george.com to example.com/~george. When visitors visit george.com, they see example.com/~george so do not redirect, add george.com as a subdomain with a document root of ~george.
Drupal in a subdirectory
When you install Drupal in /home/example/public_html/, unlevelhome.com is in /home/example/public_html/sites/unlevelhome.com/ and you access Drupal as http://unlevelhome.com/. If you install Drupal in a subdirectory, for example /home/example/public_html/drupal-6.13/, you can access Drupal as http://unlevelhome.com/drupal-6.13/.
An alternative is to change the way you park the domain. Put /drupal-6.13 the Domain Root setting. Set Domain Root to /public_html/drupal-6.13 and access Drupal as http://unlevelhome.com/.
Drupal lookup documentation
There are lots of questions about the Drupal lookup sequence to get from a domain name to a settings.php file. The Drupal documentation is in INSTALL.txt under the heading MULTISITE CONFIGURATION. The following list is the lookup sequence from Drupal 6.12 INSTALL.txt for www.sub.example.com/site3.
Note that Drupal will not look in sites/sub/settings.php or sites/site3/settings.php.
SSL certificates for multiple sites