It only took me four hours to do what should have taken less than half an hour. I finally figured out how to make multiple sites work. I'm a newbie. Thought I'd share.
First I did a single local Drupal install using this guideline: http://drupal.org/node/66187. (*See note at bottom.) This is for MacOS X. It uses MAMP. I am running everything on my own Mac computer. Eventually, of course, I will need to put my web sites on the internet. I've learned a lot in the process of getting my local installation working to help with that later.
Next, I wanted a play and experimentation site (my default Drupal site), but I also wanted to start working on a couple of real web projects: 1) blog and 2) teaching site.
After the first installation, there are four basic steps to getting multiple sites to work. I include below all the little tricks I had to figure out. What actually needs to be done is simple. Getting it to work was not simple, given that I am not a programmer, don't know unix, am not comfortable in a terminal window -- and the documentation on multiple sites is a morass.
1) Set up new folders in the Drupal sites directory (/applications/mamp/htdocs/drupal/sites) and copy in a brand new settings.php file (copy from the default.settings.php file in the default folder -- where your initial installation is) for each. See http://drupal.org/getting-started/5/install/multi-site.
Note: your folder names have to be the same as the "server names" you will set up later in the /etc/hosts file. I used:
So for each site, I created a new folder and copied in a new settings.php file:
You also have to change permissions so Drupal can access these settings files. In a terminal window:
chmod o+w blog.drupal.local/settings.php
chmod o+w teaching.drupal.local/settings.php
I will add modules and themes folders later as needed.
2) Change the web server settings. See:
I changed two files on my system as follows:
To change the /etc/hosts file:
Use terminal. (Note: this file is not findable through the Finder.)
cd /private/etc; sudo nano hosts
Give your system password and use the nano editor to make your changes. (See the control commands at bottom.)
I added below 127.0.0.1 localhost:
Change the /applications/mamp/conf/apache/httpd.conf file. Open it in a text editor. Scroll to the bottom. Add a virtual host. I added:
<VirtualHost *> ServerName drupal.local ServerAlias *.drupal.local DocumentRoot /applications/mamp/htdocs/drupal/ </VirtualHost>
Save the file.
Now use Mamp to RESTART the servers (Apache and MySql). You don’t have to turn off the Mamp application, just use the little panel. It asked me for system password each time to stop.
3) Create databases for each of the new web sites in MySql. Go to the Mamp start page (in your browser) and follow the directions from the original install guide: http://drupal.org/node/66187 to add a new database for each additional site. I named my new databases drupal_blog and drupal_teaching. I had to add a new user also for each new database since privileges are database specific. I named them tgustilo2, tgustilo3 with the same password for everything. (My original database was drupal1 with user tgustilo.)
4) Browse to each new site and the install.php will run automatically. Go through the same process as you went through with your initial install.
Type in the info as requested for the name of your database and your db user and password, etc.
Once each site is installed, you are taken to the configuration page. Voila!
NOTE - REFERENCE
I’ve created a bunch of different users in this process. I gave them all the same password.
Each web site has an admin user: admin
Each database has a user: tgustilo (for drupal1), tgustilo2 (drupal_blog), tgustilo3 (drupal_teaching). Use Mamp phpMyAdmin tool to see databases and users.
The mysql installation itself also has a user: root, for which I changed the original password per the install directions - see above. (This was done for the first install.)
Last, I wrote all this down so I never have to figure it out again!
* The only trouble I had with these directions was changing the password for the mysql user root, root. (There is a warning to change it.)
For the first command, put your newpassword at the end of the line. (This is not indicated.) You will be prompted for the current password ("root").
For the second part, open each file in a text editor and change the "root" password to your new password where called for in the file.
(It would be good if somebody edited node/66187 to reflect this.)