MAMP, localhost and multi-site

Events happening in the community are now at Drupal community events on www.drupal.org.
dotman's picture

I'm really hoping someone can help me get this right. I'm using MAMP on OX 10.6, have D7 in the htdocs folder in a floder called "civi".

I added a site folder at sites/devmydomain.org, plus folders for themes, modules and files.

Added the site.php file and added this line: $sites['devmydomain.org'] = 'devmydomain.org';

I've tried editing my private/etc/hosts with several paths with no change. If I should add a line, what should it be based on the above?

What happens is I go to http://localhost/civi/devmydomain.org, but I get redirected to http://localhost/civi/install.php

I just can't get drupal to see the see the new site. Shouldn't I get the install page here: http://localhost/civi/devmydomain.org

Any help is greatly appreciated.

Thanks,
Doug

Comments

You might be over complicating it

patrickavella's picture

You're sort of looking in the wrong place.

If you have something like

/var/htdocs/drupal/sites/mysite.org

you want apache virtual host to point to /var/htdocs/drupal

Then drupal will look at the request URL and figure out what folder your site is in. To recap, you don't need to use the sites.php file in your situation, make sure the doc root is pointed at the drupal folder, then access it with mysite.com directly. I hope that helps. Please let me know if I misunderstood what was happening.

ok, could you give me some

dotman's picture

ok, could you give me some direction on what file to edit and where it lives? this is pretty new to me.

Thanks,
Doug

I'm not familiar with mac,

patrickavella's picture

I'm not familiar with mac, but on linuxboxes it's typically /etc/apache2/httpd.conf that has all of the virtual server info, sometimes you need to create it if it's a new installation. Edit: If you have MULTIPLE SITES there's no way around this. If you're only hosting drupal multisites, you can skip this, and just install drupal right on your root. So instead of /var/htdocs/drupal it would just be /var/htdocs with the contents of the drupal folder.

<VirtualHost *:80>
        DocumentRoot /var/htdocs/drupal
        ServerName mysite.org
   ServerAlias *.mysite.org
</VirtualHost>

And in your hosts file all you should need is something like
127.0.0.1 mysite.org

I was told to creat a

dotman's picture

I was told to creat a vhost.conf file. I did and added this:

ServerName "dev.tcsaves.org"
DocumentRoot "/Applications/Mamp/htdocs/civi/sites/dev.tcsaves.org"

Options FollowSymLinks MultiViews Includes ExecCGI
AllowOverride All
Order allow,deny
allow from all

and this to my etc/hosts file:

127.0.0.1 dev.tcsaves.org

when I browse here, http;//dev.tcsaves.org, i'm redirected to the root of mamps site folder, htdocs. not the path to the folder htdocs/civi/sites/dev.tcsaves.org

so frustrating.

Purchase MAMP

builderShawn's picture

If you purchase MAMP pro it make setting up virtual hosting much much easier!

Yup there's the problem

patrickavella's picture

DocumentRoot "/Applications/Mamp/htdocs/civi/sites/dev.tcsaves.org"
should be
DocumentRoot /Applications/Mamp/htdocs/civi

Just to follow up

patrickavella's picture

I should explain this if you're not familiar.

You want the document root to be Drupal (in this case it looks like a civiCRM distro?), NOT the site folder. This is a little confusing because the instinctive thing would be to point at "the site", and in a normal website that is how you would set it up, but in this case, you need it to point to drupal. When a http request goes to the drupal folder it gets read into the system, Drupal looks at the request URL and says to it's self "Do I have any folders that match this in the sites folder? If so, that's the site I'll use", and if it doesn't find one that matches it will use the /sites/default folder.

I hope that helps :) There is definitely lots of documentation on this here on drupal.org, if you haven't already spend some time in the documentation. You'll learn other must know things in the process.

that completely makes sense.

dotman's picture

that completely makes sense. I should have noticed that. I did just change my vhosts.conf to this, without luck.

Here's a really stupid question. Is it ablsoutley necessary to even have drupal installed from the root before trying to add a multi-site? Currently I don't, but from a Drupal perspective, I wouldn't think it matters.:

<VirtualHost *:80>
  ServerName dev.tcsaves.org
  DocumentRoot "/Applications/Mamp/htdocs/civi"
  <Directory "/Applications/Mamp/htdocs/civi">
    Options FollowSymLinks MultiViews Includes ExecCGI
    AllowOverride All
    Order allow,deny
    allow from all
  </Directory>
</VirtualHost>

There's no such thing as a stupid question

patrickavella's picture

I'm not familiar with MAMP, so I don't know what its defaults are, but your vhost entry can probably look more like this

<VirtualHost *:80>
  ServerName dev.tcsaves.org
  DocumentRoot "/Applications/Mamp/htdocs/civi"
</VirtualHost>

Try putting a hello world text file in the drupal folder, something like

/Applications/Mamp/htdocs/civi/test.txt

just to make sure its actually hitting the right directory. And if you haven't, you need to restart apache before changes to that file will take effect. I think we're getting close.

I'm not sure what you mean with your question about installing drupal from the root.

it's not seeing the vhosts

dotman's picture

it's not seeing the vhosts file. i can put anything in there, and it still hits htdocs. I did try your changes. You mentioned editing the httpd.conf. I haven't edited that file. should I put the code below in that file?

<VirtualHost *:80>
  ServerName dev.tcsaves.org
  DocumentRoot "/Applications/Mamp/htdocs/civi"
</VirtualHost>

I know it's me, not drupal. just under deadline for a cms that i'm just getting my feet wet with.

A video tutorial about multisite

manuel_mra's picture

Hi:
A days ago i have found this video http://www.youtube.com/watch?v=Ap-tAeSV4Z8&feature=related . It's in french but no matter, you can be guided by the movie. It's easy. I did multisites with this video.
i hope it help you.

Manuel.

It does look like httpd.conf

patrickavella's picture

It does look like httpd.conf is the way to go according to another using asking for MAMP help

http://forum.mamp.info/viewtopic.php?t=122

bingo. i think. I added your

dotman's picture

bingo. i think. I added your code to the httpd.conf and when i browse to http://dev.tcsaves.org I get this:

http://dev.tcsaves.org/install.php

that's correct isn't it?

and when I said, run install from the root, I mean i never ran install.php from the civi folder.

So if this is correct, using a virtual host really makes the site.php file obsolete then, since apache is directing the path and not drupal. is that correct?

I spoke too soon. now if I

dotman's picture

I spoke too soon. now if I browse to any location at localhost, i'm taken to:

http://localhost/install.php

I have other sites in htdocs. some built with drupal, some not. what would be causing drupal to take over all paths?

so for instance, i have a

dotman's picture

so for instance, i have a site built in wordpress at htdocs/jerore. Now that leads to http://localhost/install.php

I tried to add another virtual host entry like this, thinking now I need one for every site;

<VirtualHost *:80>
  ServerName localhost
  DocumentRoot "/Applications/Mamp/htdocs/jerore"
</VirtualHost>

or this:

<VirtualHost *:80>
  ServerName jerore
  DocumentRoot "/Applications/Mamp/htdocs/jerore"
</VirtualHost>

I think I'm close, just need to get the other sites working as well.

Detroit

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: