Original: deployment of Nginx reverse proxy and deployment of nginx reverse proxy
Server Load balancer 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. localdomain localhost4 localhost4.localdomain4
: 1 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 Server 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. localdomain localhost4 localhost4.localdomain4
: 1 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 Server 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. localdomain localhost4 localhost4.localdomain4
: 1 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
Summary
1 The nginx. conf of the two web servers must be the same
2. Both web servers are resolved to the Server Load balancer server.
3 local win hosts Resolution Server Load balancer