Aug 05

This great tip was submitted by one of our listeners, Richard M. He is one of the board admins over at http://www.forum.cify.eu/. Thanks for the tip Richard!

Use (assuming you are in the finder) Go->go to folder->type:”/etc/httpd/”->open httpd.conf (doesn’t matter in witch text editor, but I prefer Smultron)

somewhere around line 1066
you’ll find this:

# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for requests without a known
# server name.
#
#<VirtualHost *:80>
#    ServerAdmin webmaster@dummy-host.example.com
#    DocumentRoot /www/docs/dummy-host.example.com
#    ServerName dummy-host.example.com
#    ErrorLog logs/dummy-host.example.com-error_log
#    CustomLog logs/dummy-host.example.com-access_log common
#</VirtualHost>

we’re intrested in the second part,
edit that (or, copy it and then edit the copy) to something like this:

<VirtualHost http://mymac.com:80>
ServerAdmin webmaster@mymac.com
DocumentRoot /users/richard/sites/somesite/
ServerName mymac.com
ErrorLog logs/mymac.com-error.log
CustomLog logs/mymac.com-access.log common
</VirtualHost>

and using http://mymac.com/ you get the files in /users/richard/sites/somesite/
but: the daemon account has to have access to that folder, or it will only give a internal server error

p.s. though may won’t show the folder /etc/ it does exist, as it’s a UNIX system folder,
and /etc/httpd/ is were Apache keeps it’s settings
also, to use Virtual hosts only on one account
go to /etc/httpd/users/<username>/httpd.conf and put the Virtual host instructions in there


Find this useful?

Help us spread the word! Share this with others:

  • Facebook
  • Twitter
  • del.icio.us
  • StumbleUpon
  • Digg
  • Reddit
  • Google Bookmarks
  • email

One Response to “How to use Virtual Hosts with MAMP on Mac OS X”

Leave a Reply

All content ©2009 Market Vision Media, LLC. All rights reserved. Terms of service.
preload preload preload