Skip to content

Instantly share code, notes, and snippets.

@Jmayhak
Last active August 29, 2015 14:20
Show Gist options
  • Save Jmayhak/59ed2f1e708fbd8e0164 to your computer and use it in GitHub Desktop.
Save Jmayhak/59ed2f1e708fbd8e0164 to your computer and use it in GitHub Desktop.
local MAMP setup
// You should be using MAMP (not pro) as your local server. Set up wildcard virtual hosts in MAMP. Put the following in
/Applications/MAMP/conf/apache/extra/httpd-vhosts.conf
<Virtualhost *:80>
VirtualDocumentRoot "/Users/[username]/Sites/%1/"
ServerName vhosts.[username].dev
ServerAlias *.[username].dev
UseCanonicalName Off
<Directory "/Users/[username]/Sites/*">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</Virtualhost>
// Now open /Applications/MAMP/conf/apache/httpd.conf and uncomment the following line:
Include /Applications/MAMP/conf/apache/extra/httpd-vhosts.conf
// Now, restart MAMP.
// Time to install DNSMasq with homebrew:
$ brew install dnsmasq
$ sudo cp -fv /usr/local/opt/dnsmasq/*.plist /Library/LaunchDaemons
// Copy the example config file for DNSMasq.
// NOTE: The version number (2.57) might have changed. When you finish typing “dnsmasq/“, just keep hitting tab until it autofills or it shows a list of what’s available
$ cp /usr/local/Cellar/dnsmasq/2.57/dnsmasq.conf.example /usr/local/etc/dnsmasq.conf
Modify two attributes in config file at /usr/local/etc/dnsmasq.conf:
listen-address=127.0.0.1
address=/[username].dev/127.0.0.1
// Now, we need to tell OSX that when you enter platypus.[username].dev to try and find that on your computer instead of the internet.
$ sudo mkdir /etc/resolver
$ sudo touch /etc/resolver/[username].dev
$ echo "nameserver 127.0.0.1" | sudo tee -a /etc/resolver/[username].dev
// Restart your computer.
// Start DNSMasq
$ sudo launchctl load -w /Library/LaunchDaemons/homebrew.mxcl.dnsmasq.plist
// In order to setup xdebug we need to modify the following file:
/Applications/MAMP/bin/php/php5.3.6/conf/php.ini
[xdebug]
zend_extension=".../xdebug.so"
xdebug.remote_host=127.0.0.1
xdebug.remote_enable=1
// Restart MAMP if it is running.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment