Setting up a multi-site for Drupal can be beneficial in several ways. Multiple Drupal sites are sharing the same codebase. This makes updating Drupal modules simpler since you only need to do it once for all the sites in the multi-site installation. Each site has its own database, theme and unique modules. Here is a tutorial on how I set up a multi-site installation for Drupal 6. The procedure is much the same for Drupal 7. I’m using a managed VPS with LAMP stack, cPanel and WHM. (Web Hosting Manager) Also: CentOs 4.7/Apache 2.x/mySQL 5.0/PHP 5.2
Resource:
http://drupal.org/node/348619
Main site: seascapewebhosting.ca
Site2: newdomain1.com
Site 3: newdomain2.ca
Main site: seascapewebhosting.ca
User: swdca
Db: swdca_dbname
User: swdca_dbname
Pswd: mypassword
1. Create main Drupal site per usual – this is the default site. Make sure it has your contact info on the home page since this page will display if any of the subsites fail.
2. Go into cpanel on Main site: seascapewebhosting.ca and park the domains for the other domains on your main domain. Note: On my VPS I needed to park the domains via WHM. It didn’t work via my main site cpanel.
3. Go to Main site: seascapewebhosting.ca
Create
/sites/newdomain1.com
/sites/newdomain2.ca
/sites/demo.mydomain.com
Create
/sites/newdomain1.com/files
/sites/newdomain2.ca/files
With permission 777
4. Copy /sites/default/default.settings.php to /sites/newdomain1.com
And rename it to settings.php and give it permission 777
Do the same for newdomain2.ca
5. Say you want newdomain1.com to have its own unique theme. Unique themes go in this folder; /sites/newdomain1.com/themes/customthemename
6. You will have a separate database for every site so you can activate different modules for each site. To share modules between the sites, put them in sites/all/modules in the main site. Then let each site switch them on or off.
Put unique modules in /sites/newdomain2.com/modules/modulename
7. Maintenance
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.
8. 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.
For example: 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 too 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.
Katy's notes:
For my managed VPS I needed to use Addon domains, not parked domains.
- newdomain1.com
- newdomain2.ca
In the domain name registrar for newdomain1.com and newdomain2.ca, set the DNS to your web hosting nameservers.
To set up a subsite on a subdomain:
- Create subdomain demo.seascapewebhosting.ca
- When setting up a subdomain, cPanel automatically creates a document root with the same name as the subdomain. Be sure to delete this and use public_html as the document root.
Make subdirectory for demo.seascapewebhosting.ca
- sites/demo.seascapewebhosting.ca
Make new db, user, pswd for the demo.seascapewebhosting.ca website.
Upload default.settings.php to sites/demo.seascapewebhosting.ca/
Rename to settings.php
Upload a robots.txt file to block unwanted traffic.
Your directory and file structure will look like this:
sites/demo.seascapewebhosting.ca/files
sites/demo.seascapewebhosting.ca/themes
sites/demo.seascapewebhosting.ca/modules
sites/demo.seascapewebhosting.ca/default.settings.php
sites/demo.seascapewebhosting.ca/settings.php
sites/demo.seascapewebhosting.ca/robots.xt
To install your new Drupal subsite on the subdomain:
Open your browser and point to
http://demo.seascapewebhosting.ca/install.php
The “install Drupal in English” page will come up. Enter your database information.
When updating your Drupal modules in the main site:
-Take all multi-sites offline.
-Upload the new modules
- Run update.php
- Run Cron.
- Check status report.
- Check Available updates report.
Go to each site in the multi-site and run update.php.
Run cron. Check Status report and Available updates reports.
When all is well, put site back online.
Recommendations:
Setting up a multi-site installation can save you time. Instead of having to update the same contributed modules in several different websites, you can update the main site and have all the subsites updated at the same time. The downside is that all the sites in your multi-site installation will be down at the same time. I recommend to put maximum of 5 sites in a multi-site. This way only 5 of your websites will be down at one time. The multi-site setup also works well if you have several sites that are very similar.
Comments
Setting up a multi-site for
Multi-sites set-up for drupal.
Great!
I've had a drupal multi-site