IP对应的呆板名:
IP 呆板名 脚色名
10.0.0.139 [elk] client
10.0.0.136 [lvs-master] nginx server
10.0.0.137 [kvm] web server 1
10.0.0.111 [lvs-backup] web server 2
1.1 情况先容
1.2 设置先容
Nginx server:(内网地点:10.0.0.136,外网地点:172.16.27.64)
利用VirtualBox Manager虚拟出双网卡。
[[email protected] conf.d]# ifconfig
eth0 Link encap:Ethernet HWaddr 08:00:27:30:56:99
inet addr:10.0.0.136 Bcast:10.255.255.255 Mask:255.0.0.0
inet6 addr: fe80::a00:27ff:fe30:5699/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:891978 errors:0 dropped:0 overruns:0 frame:0
TX packets:9509 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:81841095 (78.0 MiB) TX bytes:13339058 (12.7 MiB)
eth1 Link encap:Ethernet HWaddr 08:00:27:55:4C:72
inet addr:172.16.27.64 Bcast:172.16.27.255 Mask:255.255.255.0
inet6 addr: fe80::a00:27ff:fe55:4c72/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:913671 errors:0 dropped:0 overruns:0 frame:0
TX packets:22712 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:109369858 (104.3 MiB) TX bytes:1903855 (1.8 MiB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:36222 errors:0 dropped:0 overruns:0 frame:0
TX packets:36222 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:3899937 (3.7 MiB) TX bytes:3899937 (3.7 MiB)
[[email protected] conf.d]# cat zxproxy.conf
server {
listen 80; #监听的端口
server_name 10.0.0.136; #server的内容地点,与client需要网络互通
resolver 172.16.5.1; #DNS,这个是DNS,会见外网
location / {
proxy_pass http://$http_host$request_uri; #$http_host和$request_uri是nginx系统变量,不需要替换,保持原样
}
Nginx client:
只有一个内网网卡,通过会见Nginx server去会见internet,其实翻墙、肉鸡、之类的俗称就是这个道理。