Proxy:192.168.3.223 web1:192.168.3.224 web2: 192.168.3.225 三台都要求搭好lnmp架构 1、在proxy中
[iyunv@martin conf]# vi/usr/local/nginx/conf/nginx.conf(可参考下图) [iyunv@martin conf]# mkdir/usr/local/nginx/sites-enabled/ [iyunv@martin conf]# vi/usr/local/nginx/sites-enabled/agent.liuzunqing.com.conf 2、在web1和web2中(两台web服务器做相同操作)
root@martin ~]# vi/usr/local/nginx/conf/nginx.conf 配置如图1.1 由于跟proxy配置一样,所以可以从proxy拷贝过来 [iyunv@martin~]#mv /usr/local/nginx/conf/nginx.conf/usr/local/nginx/conf/nginx.conf.bak [iyunv@martin ~]# scp192.168.3.223:/usr/local/nginx/conf/nginx.conf /usr/local/nginx/conf/ [iyunv@martin ~]# vi /usr/local/nginx/sites-enabled/www.liuzunqing.com.conf [iyunv@martin~]# vi/usr/local/martin/www/index.html Web1写入This is3.22 Web2写入 This is3.224 注:内容不同以便于后面访问页面的区分。 在C:\Windows\System32\drivers\etc\hosts中加入 [iyunv@martin conf]# ps -ef |grep nginx [iyunv@martin conf]# kill -HUP 2371 刷新得到以下界面
刷新多次,会交替显示两台服务器上的内容。而在实战中,长用于服务器的负载均衡。
|