jobs项目 ubuntu 支持泛域名解析
1:安装泛域名解析软件:
sudoapt-getinstalldnsmasq
配置:
sudovim/etc/dnsmasq.conf
找到这一行,修改为
resolv-file=/etc/resolv.dnsmasq.conf
sudocp/etc/resolv.conf/etc/resolv.dnsmasq.conf
然后将/etc/resolv.conf里的DNS改为127.0.0.1
nameserver127.0.0.1
#在dnsmasq.d文件夹下写入文件jobs.conf:
address=/.dev/127.0.0.1
address=/.qa/218.240.21.105
重启:sudo/etc/init.d/dnsmasqrestart
2:安装nginx
sudoapt-getinstallnginx
配置nginx文件信息:
upstreamjobs{
server127.0.0.1:8080;
}
server{
listen80;
server_namelocalhost;
root/home/zcy/app/jobs/public;
try_files$uri@app;
location@app{
#indexindex.htmlindex.htm;
proxy_redirectoff;
proxy_set_headerHost$host;
proxy_set_headerX-Forwarded-Host$host;
proxy_set_headerX-Forwarded-Server$host;
proxy_set_headerX-Real-IP$remote_addr;
proxy_set_headerX-Forwarded-For$proxy_add_x_forwarded_for;
if($uri~*^.*?\.(eot)|(ttf)|(woff)$){
add_headerAccess-Control-Allow-Origin*;
}
proxy_connect_timeout180;
proxy_send_timeout180;
proxy_read_timeout180;
proxy_bufferingon;
proxy_passhttp://jobs;
}
error_page500502503504/50x.html;
location=/50x.html{
roothtml;
}
}