Original: deployment of Nginx reverse proxy and deployment of nginx reverse proxy

Source: Internet
Author: User
Tags sendfile nginx reverse proxy

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

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.