均衡负载服务器 10.0.0.9

[root@web03 conf]# vim nginx.conf

worker_processes  1;

events {

worker_connections  1024;

}

http {

include       mime.types;

default_type  application/octet-stream;

sendfile        on;

keepalive_timeout  65;

upstream server_pools {

## ip_hash;

server 10.0.0.7:80 weight=1 max_fails=3 fail_timeout=10;

server 10.0.0.8:80 weight=1

max_fails=3 fail_timeout=10 ;

}

server {

listen 80;

server_name bbs.etiantian.org;

location / {

proxy_pass http://server_pools;

}

}

}

hosts

[root@web03 conf]# cat /etc/hosts

127.0.0.1    localhost localhost.localdomain localhost4 localhost4.localdomain4

::1          localhost localhost.localdomain localhost6 localhost6.localdomain6

172.16.1.5     lb01

172.16.1.6     lb02

172.16.1.7     web02

172.16.1.9     web03

172.16.1.8     web01 bbs.etiantian.org www.etiantian.org

172.16.1.51     db01 db01.etiantian.org

172.16.1.31     nfs01

172.16.1.41     backup

172.16.1.61     m01

web服务器1   10.0.0.7

[root@web02 conf]# cat nginx.conf

worker_processes  1;

events {

worker_connections  1024;

}

http {

include       mime.types;

default_type  application/octet-stream;

sendfile        on;

keepalive_timeout  65;

log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '

'$status $body_bytes_sent "$http_referer" '

'"$http_user_agent" "$http_x_forwarded_for"';

server {

listen       80;

server_name  bbs.etiantian.org;

location / {

root   html/bbs;

index  index.html index.htm;

}

access_log  logs/access_bbs.log  main;

}

server {

listen       80;

server_name  www.etiantian.org;

location / {

root   html/www;

index  index.html index.htm;

}

access_log  logs/access_www.log  main;

}

}

hosts

[root@web02 conf]# cat /etc/hosts

127.0.0.1    localhost localhost.localdomain localhost4 localhost4.localdomain4

::1          localhost localhost.localdomain localhost6 localhost6.localdomain6

172.16.1.5     lb01

172.16.1.6     lb02

172.16.1.7     web02 bbs.etiantianorg www.etiantian.org blog.etiantian.org

172.16.1.9     web03

172.16.1.8     web01

172.16.1.51     db01 db01.etiantian.org

172.16.1.31     nfs01

172.16.1.41     backup

172.16.1.61     m01

10.0.0.9       bbs.etiantianorg www.etiantian.org blog.etiantian.org

web服务器2 10.0.0.8

[root@web01 conf]# cat nginx.conf

worker_processes  1;

events {

worker_connections  1024;

}

http {

include       mime.types;

default_type  application/octet-stream;

sendfile        on;

keepalive_timeout  65;

log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '

'$status $body_bytes_sent "$http_referer" '

'"$http_user_agent" "$http_x_forwarded_for"';

server {

listen       80;

server_name  bbs.etiantian.org;

location / {

root   html/bbs;

index  index.html index.htm;

}

access_log  logs/access_bbs.log  main;

}

server {

listen       80;

server_name  www.etiantian.org;

location / {

root   html/www;

index  index.html index.htm;

}

access_log  logs/access_www.log  main;

}

}

hosts

[root@web01 conf]# cat /etc/hosts

127.0.0.1    localhost localhost.localdomain localhost4 localhost4.localdomain4

::1          localhost localhost.localdomain localhost6 localhost6.localdomain6

172.16.1.5     lb01

172.16.1.6     lb02

172.16.1.7     web02

#172.16.1.8     web01   www.etiantian.org bbs.etiantian.org blog.etiantian.org

#172.16.1.9     web03

172.16.1.51     db01 db01.etiantian.org

172.16.1.31     nfs01

172.16.1.41     backup

172.16.1.61     m01

10.0.0.9     www.etiantian.org bbs.etiantian.org blog.etiantian.org etiantian.org

总结

1 两个web服务器的nginx.conf 必须是一样的

2两个web都解析负载均衡服务器

3本地win hosts解析负载均衡服务器

最新文章

  1. iOS字体加载三种方式
  2. 实时控制软件设计作业_01——汽车ABS系统分析
  3. 天津政府应急系统之GIS一张图(arcgis api for flex)讲解(六)地图搜索模块
  4. iOS开发中的权限
  5. PMO到底什么样?(3)
  6. VMware虚拟机中的常用文件介绍
  7. linux下mysql环境支持中文配置步骤
  8. jquery的extend()函数
  9. CSS学习笔记05 display属性
  10. 内存映射mmap的几个api及其使用
  11. SqlSever数据库实践周
  12. Angular HttpClient upload file with FormData
  13. Docker 容器与宿主机网段冲突导致网络无法 ping 通的解决方案
  14. 数据仓库 - 2.数据仓库设计思路及ETL设计思路
  15. python随机数学习笔记
  16. 我了解到的新知识之---Cylance Protect是干吗的?
  17. MVC源码分析 - Action/Result 过滤器(续)
  18. Android Protobuf应用及原理
  19. vue 二级列表折叠面板
  20. 了解Solr

热门文章

  1. SPOJ:Stack Overflow(并查集)
  2. iOS成员变量、实例变量、属性变量三者的联系与区别
  3. Prime Cryptarithm
  4. unity3d 公告板
  5. .net 下webservice 的WebMethod的属性
  6. vs code 代码格式化
  7. Codeforces - 1117E - Crisp String - 进制 - 交互
  8. Codeforces Round #357 (Div. 2)C. Heap Operations
  9. python __builtins__ memoryview类 (46)
  10. 【CodeForces - 546C】Soldier and Cards (vector或队列)