Frontend, wildcard on localhost

Установка dnsmasq

About the App

Install the App

  1. Press Command+Space and type Terminal and press enter/return key.
  2. Run in Terminal app:
    ruby -e "$(curl -fsSL" < /dev/null 2> /dev/null
    and press enter/return key. 
    If the screen prompts you to enter a password, please enter your Mac’s user password to continue. When you type the password, it won’t be displayed on screen, but the system would accept it. So just type your password and press ENTER/RETURN key. Then wait for the command to finish.
  3. Run:
    brew install dnsmasq

Done! You can now use dnsmasq.



Настройка dnsmasq

# Create the etc dir if needed
mkdir -p /usr/local/etc

# Create a simple configuration
# This forces the .dev domain to respond with
# You can find more information in the default config file:
#   /usr/local/opt/dnsmasq/dnsmasq.conf.example
echo "address=/.dev/" > /usr/local/etc/dnsmasq.conf

# Install the daemon startup file
sudo cp -fv /usr/local/opt/dnsmasq/*.plist \

# Start the daemon
sudo launchctl load \

Configure Mac OS X:

All we need to do is tell the resolver to use Dnsmasq for .dev domains:

# man 5 resolver
sudo mkdir -p /etc/resolver
sudo sh -c 'echo "nameserver" > /etc/resolver/dev'

You can now use any .dev domain and it will always resolve to

ping   # this still works
# PING ( 56 data bytes

ping      # you can use any domain
# PING ( 56 data bytes

ping  # or subdomain
# PING ( 56 data bytes



Переезд с .dev to .test

I have the .dev tld routed to my /Users/trysmudford/Sites directory so points to /Users/trysmudford/Sites/anything — it’s very handy. So I need to swap to a new TLD and .test seems to do the trick. Here’s how I did it (OSX 10.12, native apache setup, dnsmasq provided by homebrew).

  1. Open Finder
  2. Click ‘Go’ in the top menu bar
  3. Click ‘Go to folder’
  4. Type in: /usr/local/etc/
  5. Hit ‘Go’
  6. Open dnsmasq.conf in your favourite text editor
  7. Copy the line: address=/.dev/
  8. Change new line to: address=/.test/
  9. Save this file
  10. Go to your terminal and type the following to restart dnsmasq (type in your password when promted):
    1. sudo launchctl stop homebrew.mxcl.dnsmasq
    2. sudo launchctl start homebrew.mxcl.dnsmasq
  11. Back to Finder
  12. ‘Go’, then ‘Go to folder’
    1. Type in: /etc/resolver/
  13. Copy the file named: dev
  14. Rename the new file to test



Запуск Apache XAMPP

Если проблема с запуском апач, т.к. встроенный (в мак) апач перехватил инициативу.
Отключить встроенный Apache, чтобы освободить порт 80 для XAMPP:

sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist



файл hosts здесь:



файл dnsmasq.conf (настройка dnsmasq) здесь: 



файл httpd-vhosts.conf (настройка XAMPP vhosts) здесь:



Рестарт dnsmasq:

sudo launchctl stop homebrew.mxcl.dnsmasq
sudo launchctl start homebrew.mxcl.dnsmasq