DNSmasq和Nginx 在mac上的安装配置和启动

2016-08-05  本文已影响0人  止风者

nginx

nginx

安装

brew install nginx

启动

sudo nginx -s reload                    //重启生效

配置

/usr/local/etc/nginx/nginx.conf 中配置的内容
将root 改为你需要的路径

server {
listen 8080;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root /Users/wangyu/VMP/stb-ahsn/wwwroot/main/webapp;
index index.html index.htm;
}

DNSmasq

配置

resolv.dnsmasq.conf

/usr/local/etc/resolv.dnsmasq.conf中配置的内容
nameserver 114.114.114.114

dnsmasq.conf

/usr/local/etc/dnsmasq.conf中配置的内容
resolv-file=/usr/local/etc/resolv.dnsmasq.conf
strict-order
no-hosts
cache-size=32768
listen-address=192.168.199.235

If you don't want dnsmasq to read /etc/hosts, uncomment the

following line.

no-hosts

or if you want it to read another file, as well as /etc/hosts, use

this.

addn-hosts=/usr/local/etc/hosts.dnsmasq

hosts.dnsmasq

/usr/local/etc/hosts.dnsmasq 中配置的内容
192.168.199.235 main.sannong-service.com

启动

sudo launchctl stop homebrew.mxcl.dnsmasq
sudo launchctl start homebrew.mxcl.dnsmasq
sudo killall -HUP mDNSResponder

要运行并且开机自动运行dnsmasq,在终端运行
sudo cp -fv /usr/local/opt/dnsmasq/*.plist /Library/LaunchDaemons
sudo launchctl load /Library/LaunchDaemons/homebrew.mxcl.dnsmasq.plist

上一篇 下一篇

猜你喜欢

热点阅读