{"id":52,"date":"2008-05-14T08:04:34","date_gmt":"2008-05-14T13:04:34","guid":{"rendered":"http:\/\/www.cfchimp.com\/wordpress\/?p=52"},"modified":"2024-12-05T12:01:18","modified_gmt":"2024-12-05T17:01:18","slug":"virtual-hosts-with-mamp-on-leopard","status":"publish","type":"post","link":"https:\/\/csimmons.dev\/blog\/2008\/05\/virtual-hosts-with-mamp-on-leopard\/","title":{"rendered":"Virtual hosts with MAMP on Leopard"},"content":{"rendered":"<p>Assumptions (Kind of major assumptions):<\/p>\n<ul>\n<li>You are running Leopard (and therefore cannot use &#8220;Netinfo Manager&#8221; to edit your hosts).<\/li>\n<li>You already have MAMP up and running and MAMP is using the Apache config file located here: <code>\/Applications\/MAMP\/conf\/appache\/httpd.conf<\/code><\/li>\n<\/ul>\n<ol>\n<li> Set up a directory for your dev website.  I created: <code>\/Applications\/MAMP\/htdocs\/csimmons<\/code><\/li>\n<li>Create a &#8220;host&#8221; for your site.  In Leopard this will require you to edit the hosts file manually.  Be sure to use sudo or you will not be able to save the file.  Type the following and enter the root password when prompted:<br \/>\n<code>$ sudo pico \/etc\/hosts<\/code><br \/>\nAdd the following at the bottom<br \/>\n<code><br \/>\n# VIRTUAL HOST START<br \/>\n127.0.0.1 csimmons.dev<br \/>\n# VIRTUAL HOST STOP<br \/>\n<\/code><br \/>\nCTRL+O to write the file (then hit ENTER)<br \/>\nCTRL+X to exit pico<\/li>\n<li>Flush the DNS cache<br \/>\n<code>$ dscacheutil -flushcache<\/code><\/li>\n<li>Edit the Apache config file:<br \/>\n<code>$ pico \/Applications\/MAMP\/conf\/apache\/httpd.conf<\/code>Change the following:<br \/>\nOLD:<br \/>\n<code>ServerName localhost:8888<\/code><br \/>\nNEW:<br \/>\n<code>ServerName 127.0.0.1:8888<\/code><\/p>\n<p>Continue to the very bottom of the file (use CTRL+V to page down faster) and you will find &#8220;Section 3: Virtual Hosts&#8221;.  Add the following at the very end:<br \/>\n<code><br \/>\nNameVirtualHost 127.0.0.1<br \/>\n&lt;virtualhost 127.0.0.1&gt;<br \/>\nDocumentRoot \/Applications\/MAMP\/htdocs<br \/>\nServerName localhost<br \/>\n&lt;\/virtualhost&gt;<br \/>\n# DEVELOPMENT HOSTS START<br \/>\n&lt;virtualhost 127.0.0.1&gt;<br \/>\nDocumentRoot \/Users\/username\/Sites\/csimmons<br \/>\nServerName csimmons.dev<br \/>\n&lt;\/virtualhost&gt;<br \/>\n# DEVELOPMENT HOSTS STOP<br \/>\n<\/code><br \/>\nCTRL+O to write the file (then hit ENTER)<br \/>\nCTRL+X to exit pico<\/li>\n<li>Restart the MAMP servers.  I just click &#8220;Stop Servers&#8221; and then &#8220;Start Servers&#8221; on the MAMP widget.<\/li>\n<li>Try it out.  Point your browser to the following (no www in the address and don&#8217;t forget the port[8888]): http:\/\/csimmons.dev:8888<\/li>\n<li>Rinse.  Repeat for each of your dev sites.  Multiple sites would look like this:\n<p>hosts file:<br \/>\n<code><br \/>\n# VIRTUAL HOST START<br \/>\n127.0.0.1 csimmons.dev<br \/>\n127.0.0.1 site2.dev<br \/>\n# VIRTUAL HOST STOP<br \/>\n<\/code><br \/>\nApache config file:<br \/>\n<code><br \/>\n# DEVELOPMENT HOSTS START<br \/>\n&lt;virtualhost 127.0.0.1&gt;<br \/>\nDocumentRoot \/Users\/username\/Sites\/site2<br \/>\nServerName csimmons.dev<br \/>\n&lt;\/virtualhost&gt;<br \/>\n&lt;virtualhost 127.0.0.1&gt;<br \/>\nDocumentRoot \/Users\/username\/Sites\/site2<br \/>\nServerName site2.dev<br \/>\n&lt;\/virtualhost&gt;<br \/>\n# DEVELOPMENT HOSTS STOP<br \/>\n<\/code><\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>Assumptions (Kind of major assumptions): You are running Leopard (and therefore cannot use &#8220;Netinfo Manager&#8221; to edit your hosts). You already have MAMP up and running and MAMP is using the Apache config file located here: \/Applications\/MAMP\/conf\/appache\/httpd.conf Set up a directory for your dev website. I created: \/Applications\/MAMP\/htdocs\/csimmons Create a &#8220;host&#8221; for your site. In &#8230; <a title=\"Virtual hosts with MAMP on Leopard\" class=\"read-more\" href=\"https:\/\/csimmons.dev\/blog\/2008\/05\/virtual-hosts-with-mamp-on-leopard\/\" aria-label=\"Read more about Virtual hosts with MAMP on Leopard\">Read more<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0,"_cloudinary_featured_overwrite":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[68],"tags":[9,12,18],"class_list":["post-52","post","type-post","status-publish","format-standard","hentry","category-developer","tag-apple","tag-developer","tag-mamp"],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/pbVg43-Q","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/csimmons.dev\/blog\/wp-json\/wp\/v2\/posts\/52","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/csimmons.dev\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/csimmons.dev\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/csimmons.dev\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/csimmons.dev\/blog\/wp-json\/wp\/v2\/comments?post=52"}],"version-history":[{"count":0,"href":"https:\/\/csimmons.dev\/blog\/wp-json\/wp\/v2\/posts\/52\/revisions"}],"wp:attachment":[{"href":"https:\/\/csimmons.dev\/blog\/wp-json\/wp\/v2\/media?parent=52"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/csimmons.dev\/blog\/wp-json\/wp\/v2\/categories?post=52"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/csimmons.dev\/blog\/wp-json\/wp\/v2\/tags?post=52"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}