A place where the Joyent community can gather, help each other out, and stay informed.
You are not logged in.
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.
Offline
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.
Offline
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:
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:
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:
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
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?
Offline
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
Thanks for the help anyway!
Offline
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
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
That makes sense, thanks. Will continue with the folder based approach for the time being.
Offline
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
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
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
#
- Use name-based virtual hosting.
#
- 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
For anyone interested, I got it working like this....
httpd.conf extract
### Section 3: Virtual Hosts
#
- VirtualHost: If you want to maintain multiple domains/hostnames on your
- machine you can setup VirtualHost containers for them. Most configurations
- use only name-based virtual hosts so the server doesn't need to worry about
- IP addresses. This is indicated by the asterisks in the directives below.
#
- Please see the documentation at
- <URL:http://httpd.apache.org/docs-2.0/vhosts/>
- for further details before you try to setup virtual hosts.
#
- You may use the command line option '-S' to verify your virtual host
- configuration.
#
- 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
##
- Host Database
#
- localhost is used to configure the loopback interface
- when the system is booting. Do not change this entry.
##
- 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
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
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
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:
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
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
Sorry, can't help you there I'm afraid as I'm still on Tiger
Offline
Does this help? --> When I use mysqldump it is via the command line, where I do something like:
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
Offline
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
locate mysqldump, if you need to update the locate db then run updatedb
Offline
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