Hello --

I would like to get multi-site configuration working on my development box -- a Mac Powerbook.

Trust that I have exhausted the usual means of getting answers to this question. If I wanted to set up multisite on a Windows box or a shared hosting plan I'd be in business. As far as I can tell, the only thread where this is addressed for Mac ends with the recommendation of doing multiple installations. I do not want to do multiple installations. So please don't point me to that node.

I'm using MAMP. Inside of the MAMP htdocs folder I have a folder drupal-5.0 which contains my drupal installaton. In the sites directory I have:

default - which is my first drupal site and maps by default to http://localhost:8888/drupal-5.0. This works fine.
second_site - which is a copy of default with settings.php altered to point at a different database. I haven't changed any of the settings in this file apart from the database.

When I navigate to both localhost:8888/second_site and localhost:8888/drupal-5.0/second_site I get a 404. What do I need to do to get a url mapping to second_site. Do I need to change my Apache settings?

Any mapping will do. I am simply testing the multisite functionality pursuant to evaluating Drupal for a client.

Comments

delmont’s picture

Had the same problem. Found the solution here: http://forum.mamp.info/viewtopic.php?p=256

I'm now able to use MAMP in a multi-site setup on my Mac. Hope this helps.

brooklynwebguy’s picture

I am no so sure this applies. The thread you pointed me to is about setting up multiple hosts in a MAMP environment and seems to be a discussion independent of Drupal. I simply want to map a url to a second Drupal site configured in the sites directory. How does this apply?

delmont’s picture

It applies because you need to edit httpd.comf file in the MAMP Apache setup, and also change your own etc/hosts file so that the url requests get directed correctly.

For example, I have one drupal install hosting multiple sites. My conf file in MAMP lists those virtual hosts (I use DEVexample.com). Then, I list that domain in the etc/hosts file so that when I type DEVexample.com in FireFox it goes to my local install of drupal/sites/default. I repeat this so that DEVexample2.com goes to drupal/sites/devexample2.com, and DEVexample3.com goes to drupal/sites/devexample3.com, and so on.

After you make changes to these files, you need to reboot MAMP for them to take effect.

Hope this helps.

sambtaylor’s picture

Could you explain exactly what you change in the conf file. I tried looking at the MAMP forum post and I did not understand how it would apply. Let's say I have a Drupal SITE1, and within it's sites folder I want to have another SITE2 that opens at http://localhost:8888/SITE2

Can you explain what I need to change in these files?

schwa’s picture

Have you created the symbolic links using command-line (Terminal) yet? Don't know if this applies to your scenario, but that's one way to do the "mapping" of your subsites to the code base in a LAMP enviro. I was able to set up multisites in that manner (that is, www.example.com/drupal, www.example.com/drupal2 or www.example.com/drupal/subsite ) without any changes to httpdconf files.

jdm1cc’s picture

Using symlinks, could you provide an example of how you where the symlink would be created and point to?

-Joel

"When it comes down to dying, I want to know what it is like to have truly lived." -Lou Whittaker

darumaki’s picture

One thing to keep in mind also is when using http://localhost:8888/drupal-5.0, when you upload to a live server you are going to have to open up the sql and change all the urls from http://localhost:8888/drupal-5.0 to http://mydomain, another reason why i don't use mamp and also sometimes when you upload the mamp database to live one they are not compatible and can cause issues. Mamp is a fun toy but I wouldn't use it not even for local testing because I want my local to be as close to my live server as possible so only minimum changes have to be made prior to uploading.

pablokenfold’s picture

For the benefit of the entire community, if you don't use MAMP for you local testing, could you provide us with alternatives

darumaki’s picture

I created a subdomain on the live server for local testing, that way it matches my host setup, much better this way.

If on local only, I would recommend using Mamp Pro, and use the mac default ports so you don't have :8888 issues on the live server.

[ [
contemplating the meaning of existance, what else would I be doing
] ]

arnoldc’s picture

Come across this thread, probably too late for some but I'll jot down what I did here anyway.

I have been using a MacBook(OS-X 10.5) to run multi-sites and it is fairly straight forward once you know the procedure.

And here it is.

1. open up a terminal, type 'sudo vi /etc/apache2/http.conf' to setup virtual hosts.

Example, assume your Drupal instance is installed under /Users/AverageJoe/Sites/drupal. Add the following lines to create two virtual hosts:

NameVirtualHost 127.0.0.1:80

<VirtualHost 127.0.0.1:80>
DocumentRoot /Users/AverageJoe/Sites/drupal
ServerName drupal1.localhost
</VirtualHost>

<VirtualHost 127.0.0.1:80>
DocumentRoot /Users/AverageJoe/Sites/drupal
ServerName drupal2.localhost
</VirtualHost>

2. in the terminal, type 'sudo vi /etc/hosts' to update the host list.
Using previous example, add the following lines;

127.0.0.1     drupal1.localhost
127.0.0.1     drupal2.localhost

3. Create databases and setup Drupal site folders. The folder names should be "drupal1.localhost" and "drupal2.localhost" respectively. And update settings.php accordingly. If this step is unclear to you, please refer to Drupal site on site installation information.

4. Restart Apache server. Simply toggle checkbox OFF and then ON in System Preferences->Sharing->Web Sharing will do the trick.

5. You should now be able to see both sites with these URLs on your browser.

http://drupal1.localhost
http://drupal2.localhost
aaronchristian’s picture

Hello,

I have successfully followed your outline until step 4/5. If I type in;

http://drupal1.localhost

without "Web Sharing" on I get redirected to my "htdocs" folder. As soon as I turn it on, I am redirected to my drupal folder. This is great! However it is only showing an "indexed" list of files that include the install.php. So its as if PHP isn't properly executing from this directory. When i browse to another single site installion of drupal it runs the php as expected.

Any thoughts?

pablokenfold’s picture

Well, to answer the OP, or to help another fellow Mac user without getting into "is mamp good or bad", I can tell you, instead of accessing http://localhost:8888/second_site, you should attempt t access http://second_site:8888

Before you can pull this off though, you should place second_site in your /etc/hosts file.

First, enable show hidden files in finder (google it) or use PathFinder.

Second, go to the alias /etc/, find the file called hosts and copy it to your desktop (You can't edit it in place). Also, make a backup in case something goes wrong (it shouldn't, but it's always smart to back up when you're about to change stuff). In your desktop, open the hosts file and go to the last line. Hit enter to create a new one and type 127.0.0.1 second_site. Save the file, exit, and then copy it back to its original location (/etc).

It might ask you for an administrator account password. Authenticate.

Close all the windows of your browser and restart. Then, attempt to access second_site:8888 or second_site:8888/drupal .

Hope this helps anyone.

kevcol’s picture

If you're using MAMP Pro, setting up virtual hosts is a breeze using the GUI. Best 50 bucks you'll spend.

In the Drupal install, you'll need to set up a directory inside "drupal/sites" for each site you're creating, so your directory would look something like this:

drupal/sites/default
drupal/sites/all (for your shared modules, themes, etc.)
drupal/sites/site1
drupal/sites/site2
drupal/sites/site3

To create the virtual hosts, go to MAMP Pro and in the hosts tab, hit the small + sign under the list of hosts to add site1, site2, site3. Just make sure your disk location for each host points to the Drupal install -- NOT the site directory. So in my example, the disk location for all the sites is: /Applications/MAMP/htdocs/drupal

I spent a day going nuts because I overlooked this small bit of info and kept pointing the host to drupal/sites/site1, drupal/sites/site2, drupal/sites/site3, etc.

grykolip’s picture

a have one time the same problems with my mac and drupal installation - but couldnt solve them...

knguyen3’s picture

Hi Kevin,

Could you let me know what I need to do to make all the virtual sites available to the Internet? I am using MAMP Pro and my default site (first site) has a public DNS name with a static public IP for it. This IP is also the IP address of my web server. I can access the first site no problem from the Internet but can only access the other virtual sites locally on the web server.

Can I use one public IP to host multiple virtual sites and make them accessible from the Internet?

Thanks,

TNguyen

aaronmacy’s picture

Worked for me - thanks

(I'm running OSX 10.6 & using Drupal 7.)

aaronchristian’s picture

Hey guys,

Just thought I'd share with everyone my successful installation process for setting up my drupal 6 multisite. You can view the how-to/tutorial at our companies website (New Wave Media).

I posted it in our blog section titled "Setting up a Drupal 6 Multisite on your local MAMP environment".

It's a great post if you have currently/previously installed XAMPP but want to use MAMP (which I highly recommend). I go through the process of cleaning up apache's configuration problems and installing drupal 6 multisites in a few steps.

Feel free to submit your feedback in our comments section as well!

stephane bouillet’s picture