Last updated July 25, 2010. Created by andrew smith on November 13, 2009.
Edited by bekasu. Log in to edit this page.
No single multisite setup method above got me all the way there; if you have cPanel and Drupal installed on your original domain, follow these straightforward instructions to set up a multisite:
For 'www.yourlovelysite.com':
1. in cPanel, go to 'Subdomains'
2. enter a name for you subdomain; this is followed by '.' and your original domain name automatically, e.g. 'sub1' becomes 'sub1.yourlovelysite.com'.
3. enter a 'Document Root' -- your site's folder location that contains the index.php file created during the Drupal installation. Specifically, the 'Document Root' needs to point to the folder in your directory containing the 'index.php' file that a Drupal installation creates, e.g. 'public_html', and Create. Please note cPanel may automatically insert "public_html/sub1" - delete "sub1". If you are running under a Virtual Host, you may need to point to the folder "public_html/yourlovelysite.com"
4. in cPanel, go to 'MySQL Databases'.
5. name a new database and 'Create Database'.
6. scroll down to 'MySQL Users' and 'Add New User' - and insert a username and password (twice) - give the user all privileges. Make a note of username/password.
7. in 'Add User to Database', associate your new username with the name of the database just created.
8. in cPanel, go to 'File Manager' - though this can be done using Dreamweaver or other ftp software - create a new folder in the 'sites' folder, which is in the root of the Drupal installation, named after your subdomain, e.g. 'sub1.yourlovelysite.com'.
9. copy the file 'settings.php' from the 'sites/default' folder, which you should have already from your original Drupal install, and paste it into your new subdomain folder 'sub1.yourlovelysite.com'.
10. grant this new 'settings.php' all permissions.
11. open 'settings.php' and locate the line "$db_url = 'mysql://username:password@localhost/databasename';".
12. replace each 'variable' with the respective thing, e.g. $db_url = 'mysql://newdatabaseusername:newdatabasepassword@localhost/newdatabasename'; and save.
13. now you have a database for your new subdomain which you access using 'settings.php' in your new subdomain folder.
14. go to 'sub1.yourlovelysite.com/install.php' and follow the familiar steps for a Drupal installation.
That should do it.
You can repeat this method over and over: sub2, sub3... and so on.
Image Won't Resolve Issue
When you upload files/images to your subdomain, by default, Drupal will place that file in 'sites/default/files'. To organise and to avoid your subdomains overwriting each others' files, change the 'file system path' in 'Administer > Site configuration > File system' to something like: 'sites/sub1.yourlovelysite.com/files'. This should be remembered/reversed if the subdomain is ever moved to its own site, otherwise your pictures will disappear as Drupal is looking in the wrong place for them.
Path resolution Issue
Remember that case makes a difference on some operating systems. If you use capital letters in your paths, use them consistently.
Comments
does not work for me
I've done multisites before (a long time ago) and, whilst all of the above steps were part of the set-up, there is still something crucial missing.
Frustrating, but I can't remember exactly what it is - but I do remember there has to be something linking 'sub1.yourlovelysite.com' to the install.php or index.php.
With the steps above, there's no reason why 'sub1.yourlovelysite.com/install.php' would take you to the install window or relate to the 'sub1.yourlovelysite.com' folder in 'sites' - or am I missing something?
edit: my grave mistake - the server was doing something strange with permissions; they told me I don't need to change permissions on this server! It is working for me now anyway - this is with EUKHost - call them if this whole process takes longer than 30 mins.
Also found that I didn't need to manually change the "$db_url = 'mysql://newdatabaseusername:newdatabasepassword@localhost/newdatabasename';" line - those details can be entered through the install.php process.
$base_url in settings.php
When installing Drupal with Fantastico in cpanel, I found that it had set the $base_url. So in Step 11 above, I needed to also change the $base_url setting to my new domain name (e.g. $base_url = 'http://www.mysecondsite.com';). Commenting out the $base_url line did not work, so clearly my host (greengeeks) needs it.
---------------------------------------------
Positive outlook makes a positive world
doesnt work for me
Typing into browser http://subdomains.yourlovelysite.com will show up www.yourlovelysite.com
Thank You Very Much
I've tried a few times on three shared servers to get multisite configured: boy oh boy oh boy do I wish I could of come across this article sooner (or paid a pro to help). Frustrating!
Anyway, with CPanel, after creating subdomains (eg."xyz") I removed folders cPanel automatically creates as instructed above, created sub folders such
thisdomain.com/sites/xyz.thisdomain.com(in parallel withthisdomain.com/sites/allandthisdomain.com/sites/default), copied over thedefault.settings.phpand copied that tosettings.php. From there, in the browser address bar,http://thisdomain.com/install.phpran like it should. Fantastic!Of course, I then added a database to work with and for the first time (in I don't know how many attempts over a year), I had a multisite install with no errors or weird messages. Great!
Drupal smoothly created a
sites/xyz.thisdomain.com/filesfolder for the subdomain and the correct pointer to the/tmpfolder above the public_html root so I anticipate no issues with many future file management and versioning headaches averted. Thank You Very Much!Nobody told me there'd be days like these...