時(shí)間:2023-02-10 16:24:01 | 來(lái)源:建站知識(shí)
時(shí)間:2023-02-10 16:24:01 來(lái)源:建站知識(shí)
企業(yè)場(chǎng)景docker run -d -p 53:53/tcp -p 53:53/udp --cap-add=NET_ADMIN --name dns-server andyshinn/dnsmasq:2.75
執(zhí)行完畢以后,通過(guò)命令查看是否創(chuàng)建并運(yùn)行成功:[root@test125 ~]# docker psCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES38ae71377ef1 andyshinn/dnsmasq:2.75 "dnsmasq -k" 22 hours ago Up About an hour 0.0.0.0:53->53/tcp, 0.0.0.0:53->53/udp dns-server
docker exec -it dns-server /bin/sh
創(chuàng)建代理文件:vi /etc/resolv.dnsmasq
添加內(nèi)容:nameserver 114.114.114.114nameserver 8.8.8.8
新建本地解析規(guī)則配置:vi /etc/dnsmasqhosts
添加解析規(guī)則:192.168.1.125 dev.52itstyle.com test.52itstyle.com sit.52itstyle.com
修改dnsmasq配置文件,指定使用上述兩個(gè)我們自定義的配置文件:vi /etc/dnsmasq.conf
追加下述兩個(gè)配置resolv-file=/etc/resolv.dnsmasqaddn-hosts=/etc/dnsmasqhosts
退出容器:exit
重啟容器:docker restart dns-server
Nginx安裝yum install readline-devel pcre-devel openssl-devel -yyum install wget perl gcc -y
下載最新版本:wget https://openresty.org/download/openresty-1.13.6.1.tar.gz
解壓:tar -xvf openresty-1.13.6.1.tar.gz
安裝配置:./configure
您可以使用下面的命令來(lái)編譯安裝:make && make install
如果您的電腦支持多核 make 工作的特性, 您可以這樣編譯安裝:make && make install -j2
為了方便啟動(dòng),建立軟連接:ln -s /usr/local/openresty/nginx/sbin/nginx /usr/sbin/nginx
在/usr/local/openresty/nginx/conf文件夾下創(chuàng)建vhosts目錄,然后依次創(chuàng)建一下文件(演示文件,正式環(huán)境中會(huì)有多個(gè)項(xiàng)目轉(zhuǎn)發(fā))。server{ listen 80; server_name dev.52itstyle.com; proxy_set_header Host $host; location /{ proxy_pass http://192.168.1.170:8080; }}
test.52itstyle.com.conf:server{ listen 80; server_name test.52itstyle.com; proxy_set_header Host $host; location /{ proxy_pass http://192.168.1.180:8080; }}
sit.52itstyle.com.conf:server{ listen 80; server_name sit.52itstyle.com; proxy_set_header Host $host; location /{ proxy_pass http://192.168.1.190:8080; }}
配置文件:vi /usr/local/openresty/nginx/conf/nginx.confworker_processes 2;events { worker_connections 1024;}http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; #導(dǎo)入各個(gè)環(huán)境 include vhosts/*.conf;}
啟動(dòng)服務(wù):執(zhí)行 nginx命令即可。關(guān)鍵詞:代替,使用,地址,代理
客戶&案例
營(yíng)銷資訊
關(guān)于我們
客戶&案例
營(yíng)銷資訊
關(guān)于我們
微信公眾號(hào)
版權(quán)所有? 億企邦 1997-2025 保留一切法律許可權(quán)利。