We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nginx 的负载均衡配置起来很简单, 如下:
upstream resinserver{ ip_hash; server 127.0.0.1:8000 down; server 127.0.0.1:8080 weight=2; server 127.0.0.1:6801; server 127.0.0.1:6802 backup; } #Ip_hash:每个请求按访问ip的hash结果分配,这样每个访客固定访问一个后端服务器,可以解决session的问题 #down:不参与负载均衡 #weight:比重,越大的分配的越多 #backup:其他的非backup机器都down或者忙的时候才会请求到这台机器 ``` 例子: ``` 一个简单的负载均衡与反向代理配合使用的例子 http{ upstream test{ ip_hash; server 127.0.0.1:8888 server 127.0.0.1:9999 } server { listen 80; server_name test.com location / { proxy_pass http://test; proxy_set_header Host $host:8888; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } } } ```
The text was updated successfully, but these errors were encountered:
No branches or pull requests
nginx 的负载均衡配置起来很简单, 如下:
The text was updated successfully, but these errors were encountered: