-
-
Save fraserxu/011c5f9d8e5b9c270a1dcac72a506e00 to your computer and use it in GitHub Desktop.
Local Setup for .test Domains (dnsmasq + nginx)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo -v | |
brew install dnsmasq nginx | |
echo "address=/test/127.0.0.1" > /usr/local/etc/dnsmasq.conf | |
vim /usr/local/etc/nginx/nginx.conf | |
vim /usr/local/etc/nginx/servers/market-shopfront.conf | |
tee /usr/local/etc/nginx/nginx.conf > /dev/null << EOF | |
#user nobody; | |
worker_processes 1; | |
#error_log logs/error.log; | |
#error_log logs/error.log notice; | |
#error_log logs/error.log info; | |
#pid logs/nginx.pid; | |
events { | |
worker_connections 1024; | |
} | |
http { | |
include mime.types; | |
default_type application/octet-stream; | |
#access_log logs/access.log main; | |
sendfile on; | |
#tcp_nopush on; | |
#keepalive_timeout 0; | |
keepalive_timeout 65; | |
#gzip on; | |
include sites-enabled/*.test; | |
} | |
EOF | |
sudo mkdir -p /etc/resolver | |
sudo tee /etc/resolver/test >/dev/null <<EOF | |
nameserver 127.0.0.1 | |
EOF | |
sudo cp -fv /usr/local/opt/dnsmasq/*.plist /Library/LaunchDaemons | |
sudo chown root /Library/LaunchDaemons/homebrew.mxcl.dnsmasq.plist | |
sudo launchctl load /Library/LaunchDaemons/homebrew.mxcl.dnsmasq.plist | |
sudo ln -sfv /usr/local/opt/nginx/*.plist ~/Library/LaunchAgents | |
sudo chmod 600 ~/Library/LaunchAgents/homebrew.mxcl.nginx.plist | |
sudo chown root ~/Library/LaunchAgents/homebrew.mxcl.nginx.plist | |
sudo launchctl load ~/Library/LaunchAgents/homebrew.mxcl.nginx.plist |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment