The Joyent Community

A place where the Joyent community can gather, help each other out, and stay informed.

You are not logged in.

#1 2007-08-06 03:58:11

kvnmcwebn
Member
From: ireland
Registered: 2007-06-07
Posts: 38
Website  Expertise

managing more than one local site with mamp

hi,
is it possible to run more that one local site simultaneously with the free version of mamp?
-best
kvnmcwebn

Offline

 

#2 2007-08-06 07:07:47

greyfodder
Chief Happiness Officer
From: Los Angeles, CA
Registered: 2004-06-01
Posts: 1208
Website  Expertise

Re: managing more than one local site with mamp

I'm doing this now, but not at the same time. I create a folder for each site, then when I need to work on it I rename it to htdocs. I've got about 10 setup that way right now. I'd love to be able to run them simultaneously.


I was here when this place was cool.

vc200 - Twitter Extraordinaire

Offline

 

#3 2007-08-06 10:26:43

andrewbarnett
Discussion Artist
From: Melbourne, Australia
Registered: 2005-09-12
Posts: 2064
Website  Expertise

Re: managing more than one local site with mamp

I set the document rot to be my ~/Sites directory. I create subdirectories under that. Of course, I have to load http://localhost:8888/directory-name/, which is probably the thing you're trying to avoid, but I can have multiple open.


VC3 - MGX - Acceleratus - Litho - SSSTMWCNGQBRKAS

Offline

 

#4 2007-08-06 13:57:16

Lamancha
Back in Blighty
Registered: 2006-03-16
Posts: 39
Expertise

Re: managing more than one local site with mamp

Headdress makes it easy.

Offline

 

#5 2007-08-06 16:31:02

springworks
Member
From: England
Registered: 2005-04-04
Posts: 122
Website  Expertise

Re: managing more than one local site with mamp

And you don't even need Headdress if you don't mind a little manual text editing. Here's how:

1. With a text editor that can open hidden files (eg TextWrangler (free) or TextMate), open /private/etc/hosts

2. Find the line which reads:

Code:

127.0.0.1    localhost


3. add the name of your chosen virtualhosts at the end of this line, separating each of them with a space, like this:

Code:

127.0.0.1    localhost mytestdomain1.dev mytestdomain2.dev


4. Save the file. You will need to provide an Administrator password to do this.

5. Create a folder for each of your test domains in the Sites folder in your home folder, eg:
/Users/myusername/Sites/mytestdomain1.dev
/Users/myusername/Sites/mytestdomain2.dev

6. Now open the MAMP httpd.conf, which you can find in /Applications/MAMP/conf/apache/httpd.conf

7. At the end of this file, insert the following:

Code:

NameVirtualHost *:80

<VirtualHost *:80>

ServerName localhost DocumentRoot "/Users/myusername/Sites"
</VirtualHost>

<VirtualHost *:80>

ServerName mytestdomain1.dev DocumentRoot "/Users/myusername/Sites/mytestdomain1.dev"
</VirtualHost>

<VirtualHost *:80>

ServerName mytestdomain2.dev DocumentRoot "/Users/myusername/Sites/mytestdomain2.dev"
</VirtualHost>


8. In the MAMP preferences, choose the Ports section and click on the "Use default Apache and MySQL ports". Now stop the MAMP servers and restart them again.

You should now be able to reach all of your test domains at the same time, using just the domain name as the address, none of this "localhost:8888/mytestdomain1/" stuff.

Last edited by springworks (2007-08-06 16:33:25)

Offline

 

#6 2007-08-08 06:36:06

greyfodder
Chief Happiness Officer
From: Los Angeles, CA
Registered: 2004-06-01
Posts: 1208
Website  Expertise

Re: managing more than one local site with mamp

Hey springworks, just tried this and got it working! How fantastic! What I'd love next is Bonjour, so I can see/work on the network. Anyway to do this?


I was here when this place was cool.

vc200 - Twitter Extraordinaire

Offline

 

#7 2007-08-08 07:47:08

springworks
Member
From: England
Registered: 2005-04-04
Posts: 122
Website  Expertise

Re: managing more than one local site with mamp

greyfodder wrote:

Hey springworks, just tried this and got it working! How fantastic! What I'd love next is Bonjour, so I can see/work on the network. Anyway to do this?


Glad you got it working greyfodder.

Wish I could help with getting it working with Bonjour, but I wouldn't even know where to start I'm afraid - it would be cool though ;-)

I'm guessing that you would need to set up a local DNS service for it to work over your local network and that is way out of my depth!

Offline

 

#8 2007-08-08 08:03:53

greyfodder
Chief Happiness Officer
From: Los Angeles, CA
Registered: 2004-06-01
Posts: 1208
Website  Expertise

Re: managing more than one local site with mamp

Thanks for the help anyway!


I was here when this place was cool.

vc200 - Twitter Extraordinaire

Offline

 

#9 2007-08-25 07:00:57

britishseapower
Member
From: blighty, dear blighty
Registered: 2007-08-14
Posts: 131
Expertise

Re: managing more than one local site with mamp

I'm liking MAMP very much at the moment and think I'll be running into this multiple folder issue soon enough.

I'm using andrewbarnet's simple method of just creating subfolders under the Sites folder...and then navigating to http://localhost:8888/ where I get list of my sites to choose from.

While I'm happy with this I'd be keen to know if there are other advantages from seemingly more sophisticated approach above. A few extra mouse clicks don't bother me especially if it keeps it simple, but I'd like to start doing things properly.

ta

bsp

Offline

 

#10 2007-08-25 09:40:17

springworks
Member
From: England
Registered: 2005-04-04
Posts: 122
Website  Expertise

Re: managing more than one local site with mamp

The biggest benefit I've found is that with the more sophisticated approach the different test sites all appear at the top level web directory, (http://mytestsite1.dev/, http://mytestsite2.dev/, etc.), which just feels more natural and more closely replicates what the situation will be like when they are up on the world wide interweb under their own proper domains.

Obviously your solution using sub-folders (http://localhost:8888/mytestsite1/, http://localhost:8888/mytestsite2/, etc.) works well enough, but can lead to some confusion for navigation and relative links within the site as the site root folder is not the same as the web server htdocs root folder.

Ultimately though it doesn't make a huge difference, so the decision is yours and you should go with what you are happiest with and most comfortable using.

Offline

 

#11 2007-08-25 09:51:10

britishseapower
Member
From: blighty, dear blighty
Registered: 2007-08-14
Posts: 131
Expertise

Re: managing more than one local site with mamp

That makes sense, thanks. Will continue with the folder based approach for the time being.

Offline

 

#12 2007-09-01 18:15:10

britishseapower
Member
From: blighty, dear blighty
Registered: 2007-08-14
Posts: 131
Expertise

Re: managing more than one local site with mamp

springworks, after setting this up it's not quite working.

after running into a lot of problems with relative paths I need to set this up like you,
what's your document root set to in MAMP?

Offline

 

#13 2007-09-18 13:39:57

springworks
Member
From: England
Registered: 2005-04-04
Posts: 122
Website  Expertise

Re: managing more than one local site with mamp

britishseapower wrote:

springworks, after setting this up it's not quite working.

after running into a lot of problems with relative paths I need to set this up like you,
what's your document root set to in MAMP?


Hi bsp,

Sorry it's taken me so long to reply to this - I've been away on holiday.

I've got my document root set to the Sites folder in my home folder (/Users/myusername/Sites).

Hope this helps.

Steve

Offline

 

#14 2007-09-25 12:03:24

britishseapower
Member
From: blighty, dear blighty
Registered: 2007-08-14
Posts: 131
Expertise

Re: managing more than one local site with mamp

Am trying to get local hosting set up well on OSX and with MAMP.
Any ideas, have I missed something fundamental?

Would really appreciate any ideas, it's so important to me to have a local dev environment
(as similar to my textdrive system as possible).

I have turned off mac personal webserver, don't need two apaches running I assume.

MAMP preferences - I've set apache and mysql ports to the defaults, i.e. 80 for apache

MAMP docroot is set to "/Applications/MAMP/conf/apache"

Not working though, I'd expect to be able to restart MAMP and locally browse to "http://europa.dev/"

This is the tail end of my httpd.conf located in /Applications/MAMP/conf/apache

Code:

#

  1. Use name-based virtual hosting.
  2. #

  3. NameVirtualHost *
    <VirtualHost *:80> ServerName localhost DocumentRoot "/Users/rupert/Sites"
    </VirtualHost>
    <VirtualHost *:80> ServerName europa.dev DocumentRoot "/Users/rupert/Sites/europa"
    </VirtualHost>
    <VirtualHost *:80> ServerName firestation.dev DocumentRoot "/Users/rupert/Sites/firestation"
    </VirtualHost>

Last edited by britishseapower (2007-09-25 12:05:41)

Offline

 

#15 2007-09-25 17:38:24

britishseapower
Member
From: blighty, dear blighty
Registered: 2007-08-14
Posts: 131
Expertise

Re: managing more than one local site with mamp

For anyone interested, I got it working like this....

httpd.conf extract

Code:

### Section 3: Virtual Hosts

#

  1. VirtualHost: If you want to maintain multiple domains/hostnames on your
  2. machine you can setup VirtualHost containers for them. Most configurations
  3. use only name-based virtual hosts so the server doesn't need to worry about
  4. IP addresses. This is indicated by the asterisks in the directives below.
  5. #

  6. Please see the documentation at
  7. <URL:http://httpd.apache.org/docs-2.0/vhosts/>
  8. for further details before you try to setup virtual hosts.
  9. #

  10. You may use the command line option '-S' to verify your virtual host
  1. configuration.
  2. #

  3. Use name-based virtual hosting.

#

NameVirtualHost *

<VirtualHost *>

DocumentRoot "/Users/rupert/Sites" ServerName localhost
</VirtualHost>

<VirtualHost *>

DocumentRoot "/Users/rupert/Sites/europa" ServerName europa.dev
</VirtualHost>

<VirtualHost *>

DocumentRoot "/Users/rupert/Sites/firestation" ServerName firestation.dev
</VirtualHost>


hosts

Code:

##

  1. Host Database
  2. #

  3. localhost is used to configure the loopback interface
  4. when the system is booting. Do not change this entry.
  5. ##

  6. 127.0.0.1 localhost europa
    127.0.0.1 localhost firestation.dev europa.dev


All is well with the world, localhostin' makes me happy - specially when it works. :-)

If anyone has any tips how i can make this rig even closer to the Textdrive setup would appreciate it.

Offline

 

#16 2007-11-17 15:17:52

kvnmcwebn
Member
From: ireland
Registered: 2007-06-07
Posts: 38
Website  Expertise

Re: managing more than one local site with mamp

hi, wow thats great springworks.
I asked this question a while back and then had problems with mamp and stopped using it.
But am back at it now and this is great. thanks a lot.

The only problem is that the apache server wont start up from mamp after i followed your steps.
Any ideas why?

Offline

 

#17 2007-11-18 17:32:42

kvnmcwebn
Member
From: ireland
Registered: 2007-06-07
Posts: 38
Website  Expertise

Re: managing more than one local site with mamp

hi again,
it works great on my intel mac just not on my ppc. no probs only need it on one.
Your the man springworks.
-best
kevin

Offline

 

#18 2008-06-27 18:59:27

Lamancha
Back in Blighty
Registered: 2006-03-16
Posts: 39
Expertise

Re: managing more than one local site with mamp

Springworks/Anyone, Any idea how you would tweak this to allow other local machines to "see" the dev sites? I need to test on IE on a local PC, bit can't work out how to share access.

Offline

 

#19 2008-06-30 08:10:40

springworks
Member
From: England
Registered: 2005-04-04
Posts: 122
Website  Expertise

Re: managing more than one local site with mamp

Lamancha wrote:

Springworks/Anyone, Any idea how you would tweak this to allow other local machines to "see" the dev sites? I need to test on IE on a local PC, bit can't work out how to share access.


You would need to edit the host file on each local machine to match the .dev address to the IP of your development machine.

So, for instance, if your local development machine had the IP address 192.168.1.1, then you would add the following line to the hosts file on any other local computer to point them to your development machine:

Code:

192.168.1.1    mytestdomain1.dev mytestdomain2.dev


On a Mac , the hosts file can be found at /private/etc/hosts

Not sure where you would find it on a PC, sorry.

Hope this helps.

Offline

 

#20 2008-07-01 07:59:28

Lamancha
Back in Blighty
Registered: 2006-03-16
Posts: 39
Expertise

Re: managing more than one local site with mamp

Springworks, you are a star, that worked a treat - now all I have to do is figure out how to configure Leopard's firewall to allow only one machine on the local network access.....

Offline

 

#21 2008-07-01 08:32:06

springworks
Member
From: England
Registered: 2005-04-04
Posts: 122
Website  Expertise

Re: managing more than one local site with mamp

Sorry, can't help you there I'm afraid as I'm still on Tiger

Offline

 

#22 2008-10-23 18:26:21

kvnmcwebn
Member
From: ireland
Registered: 2007-06-07
Posts: 38
Website  Expertise

Re: managing more than one local site with mamp

If the mamp mysql path is here:
/Users/username/Applications/MAMP/db/mysql/site

anyone know where the mamp mysqldumppath is??
thanks
kevin

Offline

 

#23 2008-10-23 18:35:51

iolaire
Member
From: Arlington, VA USA
Registered: 2005-03-02
Posts: 808
Website  Expertise

Re: managing more than one local site with mamp

Does this help? --> When I use mysqldump it is via the command line, where I do something like:

Code:

mysqldump DatabaseName --add-drop-table -h localhost -u Username -pPassword > ~/OutPutFile.sql


So in this example it would end up in the base level of your user directory: machinename/users/username/OutPutFile.sql


My refurbished Mac site -> While Supplies Last. The next site is Decreasing Prices with daily updates and minor tweaks now and then...

Offline

 

#24 2008-10-23 19:14:33

kvnmcwebn
Member
From: ireland
Registered: 2007-06-07
Posts: 38
Website  Expertise

Re: managing more than one local site with mamp

yeah that makes sense..im not using it in that same way but i might try something based on that.
thanks
no didnt work...

im using a plugin for my cms(textpattern) that requires the dump path to be specified. This is because its running on localhosting and maybe also becuase of the above mamp ehahncements which ive been using.
What i need is the full path to the Mysqldump Path executable. not sure where to find it.

There must be something i could type into terminal like:

whereis mysqldump

??
guess i dont know engough about mysql :rolleyes:

Last edited by kvnmcwebn (2008-10-23 19:30:52)

Offline

 

#25 2008-10-23 19:32:39

iolaire
Member
From: Arlington, VA USA
Registered: 2005-03-02
Posts: 808
Website  Expertise

Re: managing more than one local site with mamp

locate mysqldump, if you need to update the locate db then run updatedb


My refurbished Mac site -> While Supplies Last. The next site is Decreasing Prices with daily updates and minor tweaks now and then...

Offline

 

#26 2008-10-23 19:39:18

kvnmcwebn
Member
From: ireland
Registered: 2007-06-07
Posts: 38
Website  Expertise

Re: managing more than one local site with mamp

cheers!!!

Offline

 

#27 2009-06-12 20:02:49

bawigga
New member
Registered: 2009-06-12
Posts: 2
Expertise

Re: managing more than one local site with mamp

I like using MAMP with VirtualHostX, VHX makes managing virtual hosts under MAMP a snap.

http://clickontyler.com/virtualhostx/

If you install VHX after MAMP, it should detect that you have MAMP installed and set it up for you. If not here's a GetSatisfaction link on how other have gotten these to work together.

http://getsatisfaction.com/clickontyler/topics/how_do_i_get_virtualhostx_mamp_and_the_php_within_mamp_to_work

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2005 Rickard Andersson