Good multi-site tips for drupal

© 2022 www.JaxBeachTech.com  |  Ph: 9o4.834.o433  |   email  |  [50.41]

Submitted by donmc on Mon, 05/04/2009 - 16:48
Topic

All of this is using the Web Developer Server Suite http://www.devside.net/ using their database password and installed to c://www/

1. Database: phpMyAdmin > Create a database for each local site you want to create.
2. Drupal: sites/default > Paste a copy of this folder for each site you want to create > edit the settings.php for each site.
3. Apache: Add a virtual host for each site in Apache22/conf/extra/httpd-vhosts.conf
4. Windows: Inform windows that each site is hosted locally in c:/windows/system32/drivers/etc/hosts
5. Reboot, or stop and restart Apache2
6. Open your browser and type in the http://siteaddress/install.php and follow the prompts. Do this for each site.

Database: phpMyAdmin > Create a database for each local site you want to create.
Open phpMyAdmin and type a name for your database (playsite) in the Create new database textbox, click Create (I left Collation, in the dropdown box). You should get a message that says your database is created. Click Home icon and add the next one.

Drupal: sites/default > Paste a copy of this folder for each site you want to create > edit the settings.php for each site.
The 1st copy I create is a folder called: copy from I then add to this folder a files, modules, themes, & tmp folder so that as I paste from this all the folders I need are also created.
Copy and paste to the drupal/sites/ one folder for each site you created a database for from your default (or copy from) folder rename each folders what you want the site address to be (mysite.tst). I like to have .tst at the end so I know I'm not online, and I don't accidentally go to a real site. Before you start to copy make sure the settings.php isn't marked as read only (right-click>Properties>Read-only need to be unchecked).

Open settings.php (using a text editor) from the Copy From or default folder and edit the lines necessary.
$db_url = 'mysql://username:password@localhost/databasename';
($db_url = 'mysql://root:rootwdp@localhost/playsite';)
$base_url = 'http://siteaddress';
($base_url = 'http://mysite.tst';)
Save As to the folder for the site you addressed in the previous step. Do this for each site you want to create. Use the file you have open, just changing what you need to in the file and Saving As to each of the folders. You don't have to reopen the copy from or default file.

Apache: Add a virtual host for each site in Apache22/conf/extra/httpd-vhosts.conf
(if you haven't already done so you need to remove the # from front the the line in httpd.conf in Appache22/conf/ that says # Include conf/extra/httpd-vhosts.conf)
Open in a text editor the file Appache/conf/extra/httpd-vhost.conf, add to the bottom:

<VirtualHost *:80>
DocumentRoot /www/drupal/
ServerName siteaddress (ServerName mysite.tst)
</VirtualHost>

Windows: Inform Windows that your site is hosted locally in c:/windows/system32/drivers/etc/hosts
Open in a text editor, the file hosts in c:/windows/system32/drivers/etc/ (You can do this from within the Web-Developer Controller Other>Windows HOSTS File) at the end of the file if it isn't there already add: 127.0.0.1 localhost then add the same for each site you are creating to host locally:
127.0.0.1 siteaddress (127.0.0.1 mysite.tst)

Reboot, or stop and restart Apache2
You can stop Apache 2 from within Web-Developer Controller. Click on Apache2 and click on Stop Service, when the status reads Stopped click on Start Service when the status reads Running you're good to go.

Open your browser and type in the http://siteaddress/install.php
Open your browser and in the address bar type http://siteaddress/install.php (http://mysite.tst/install.php), this begins the installation and populates your database with the tables. You'll get a message saying Congratulations, Drupal has been successfully installed. click on the link your new site. And you'll see a Welcome screen exactly the same as when you install on a "real" server. Click on the link create the first account. in Step 1, and you will be creating your Administrator account in Drupal. You will receive a warning about the mail function because unless you set up your local host to send email it can't, so make sure to save your just created User Name and Password somewhere safe because without it being able to send an email I'm not sure you could get into the administration any other way.

Your done.