Skip to content

Instantly share code, notes, and snippets.

@brndnblck
Created April 19, 2017 20:22
Show Gist options
  • Save brndnblck/ee81745569ae98306555f108bf69ff5c to your computer and use it in GitHub Desktop.
Save brndnblck/ee81745569ae98306555f108bf69ff5c to your computer and use it in GitHub Desktop.
Local Setup for .dev Domains (dnsmasq + nginx)
sudo -v
brew install dnsmasq nginx
echo "address=/dev/127.0.0.1" > /usr/local/etc/dnsmasq.conf
vim /usr/local/etc/nginx/nginx.conf
vim /usr/local/etc/nginx/servers/stacksocial.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 servers/*;
}
EOF
sudo mkdir -p /etc/resolver
sudo tee /etc/resolver/dev >/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