RHEL7下Nginx负载均衡配置
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了RHEL7下Nginx负载均衡配置相关的知识,希望对你有一定的参考价值。
RHEL7下nginx负载均衡配置
前面两节讲过安装和配置文件了,这里写出配置文件,大家根据内容修改配置文件就可以了。
http {
upstream myserver{
server 192.168.1.21:80 weight=2 max_fails=3 fail_timeout=20s;
server 192.168.1.22:80 weight=3 max_fails=3 fail_timeout=20s;
server 192.168.1.23:80 weight=4 max_fails=3 fail_timeout=20s;
}
server{
listen 80;
server_name 192.168.1.20;
index index.htm index.html;
root /application/nginx/html/
location / {
proxy_pass http://myserver;
prox_next_upstream http_500 http_502 http_503 error timeout invalid_header;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
client_body_buffer_size 128k;
proxy_connect_timeout 60s;
proxy_send_timeout 60s;
proxy_read_timeout 60s;
proxy_buffer_size 4k;
proxy_buffers 4 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;
}
}
}
本文出自 “随风飘扬” 博客,请务必保留此出处http://wjb10000.blog.51cto.com/9702295/1792555
以上是关于RHEL7下Nginx负载均衡配置的主要内容,如果未能解决你的问题,请参考以下文章