A Smarter MAMP Redux…


A number of years back I was introduced to BIND by an article titled A Smarter MAMP. In the following tutorials I’ll try and pay the favor forward to those who have yet to discover the awesomeness of running a local DNS server on top of a typical AMP (Apache MySQL PHP) stack. BIND isn’t the only option. If you want a DNS server with little to no configuration then DNSMasq is the better option for you.


BIND | Apache | MySQL | PHP


Lets take a minute to talk about how we will eventually install the stack in reverse order.

PHP is installed on OS X by default, So we only need to load it’s module in our Apache config file.

MySQL is readily available from www.mysql.com; but I like to install it via Homebrew.

Apache is installed with OS X as well. It just needs a little configuration and to be loaded on boot.

BIND can also be installed via Homebrew

You’re probably familiar with the AMP part but what about the “B”. What can BIND do that you can’t do with out it? Let’s review the old way of doing things versus the new way with BIND.

Hosts file vs BIND:

Normally you would use the /private/etc/hosts file to handle the DNS for your local web server (Apache). In the Hosts file you’d have to make a manual entry for each domain or subdomain; and point those entries to your localhost ip address If you are developing multiple sites or working on sites with multiple subdomains, this can lead to a lot of hosts editing since you cannot use wildcards in the hosts file. In addition each time you edit it you’ll need to restart Apache, and potentially flush your DNS caches. Also the effect of managing DNS using the hosts file is confined to your computer and can’t be shared on the local network. BIND frees you of those limitations. It accepts wildcards so you can make a single zone file to handle the DNS for an entire top level domain. Want endless subdomains? Bind can handle it. Think *.dev. Can you share your sites over your LAN? Yes you can! Other computers on the local network can be configured to use your computer as a DNS server thus sharing your development sites over the LAN.

More BIND Pros:

What other tricks can we do with BIND? It can set forwarding DNS servers to use OpenDNS of GoogleDNS to speed up your internet connection and free you from your ISP’s sluggish servers. It can even be configured to cache DNS locally speeding things up even more. BIND does multicastDNS as well. Think Bonjour. OS X can also be configured to use the local DNS server even in the absence of a network connection. So you can work on your development sites despite not having an internet connection.

BIND Cons:

It’s not included on OS X by default and you have to install it from an external source. The configuration can be difficult to wrap your head around. Documentation for setting it up on OS X is not readily available outside of various blog posts on the subject.

Getting into BAMP:

Finally, let’s get BAMP up and running on OS X El Capitan. We’ve got a bit of ground to cover so let’s break this out into a series of Tutorials. First we’ll get our web server (Apache) running. Then we’ll glue it all together with DNS a la BIND. Then we’ll check to see that PHP is loaded and working. And finally we’ll install MySQL and phpMyAdmin.





Post a Comment

Your email is never published nor shared. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>