I am currently attempting to set up a multi site installation on my machine so I can develop multiple sites from one Drupal code base. I have been following these tutorials:
http://drupal.org/node/32715
http://drupal.org/node/120647
and have followed the steps to create a default site and a site named GA. I have added host names drupal and GA to the /etc/hosts file and have a virual host section configured for each one accessed through .conf files in the vhosts.d dir under apache2 dir. I also have a localhost virtual server for other development. I have altered settings in sites/GA to point to a different database and tried changing the base_url but whenever I enter either http://drupal or http://GA I am given the same site. I have confirmed that I am using the same db by altering the sitename and the change appears on both. What am I doing wrong?
default vhost file:
Listen 80
NameVirtualHost *:80
<VirtualHost *:80>
ServerName localhost
Include /etc/apache2/vhosts.d/default_vhost.include
<IfModule mpm_peruser_module>
ServerEnvironment apache apache
</IfModule>
</VirtualHost>
<VirtualHost *:80>
ServerName drupal
Include /etc/apache2/vhosts.d/drupal_vhost.include
<IfModule mpm_peruser_module>
ServerEnvironment apache apache
</IfModule>
</VirtualHost>
<VirtualHost *:80>
ServerName GA
Include /etc/apache2/vhosts.d/GA_vhost.include
<IfModule mpm_peruser_module>
ServerEnvironment apache apache
</IfModule>
</VirtualHost>
GA_vhost.include:
DocumentRoot "/var/www/drupal"
<Directory "/var/www/drupal">
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
drupal_vhost.include is the same as the above.
default settings.php:
$db_url = 'mysql://user:pass@localhost/drupal_default';
$base_url = 'http://drupal';
GA settings.php
$db_url = 'mysql://user:pass@localhost/GA';
$base_url = 'http://GA';
Comments
This may or may not help,
This may or may not help, but when I set up multiple virtual sites on a "localhost" server I name them like this:
localhost
drupal.localhost
GA.localhost
in /etc/hosts and httpd.conf.
Always works for me. Don't forget to restart Apache.
had tried that
Yes I had thought that may have been something to do with it and I had tried it already. I tried it again as you suggest but did not work for me. I think I am missing something very basic and just can't recognise it at the moment. At first I thought that the GA host was not being recognised and was by default matching the drupal one but if I alter the DocumentRoot from /var/www/drupal to /var/www/drupal/sites/GA for GA I just get a directory listing so it is being matched. Even if I then try to symlink to everything I need in /var/www/drupal such as index.php etc GA fails to load properly with an error message can't load the settings.php file from bootstrap.inc. It is looking for default/settings.php when it should be looking for sites/GA/settings.php so it seems that the host is not being recognised properly.
If it makes a difference this is on a 5.7 version but then again I had the same problem when it was 5.3 so I don't think the version has anything to do with it.
Fixed it
I have figured what was causing this problem it was the case of the vhosts domain name. Even though I had defined it everywhere as GA when I changed the directory name from sites/GA to sites/ga it started working. So it seems that lower case directory names are needed. It seems to be that whenever the browser sees http://GA it converts it to http://ga and then the directories don't match.