用dnsmasq设置本地开发dev环境

作弊条一个,主要是为了映射多个项目的.dev泛域名解析到localhost

brew install dnsmasq
cat << EOF > /usr/local/etc/dnsmasq.conf
address=/.dev/127.0.0.1
listen-address=127.0.0.1
port=35353
EOF
sudo mkdir /etc/resolver
sudo chown `whoami`:admin /etc/resolver
cat << EOF > /etc/dev
nameserver 127.0.0.1
port 35353
EOF

使用了brew services的话还可以直接brew services start dnsmasq就启动了

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.