您的当前位置:首页 --> 新闻中心 -->Nginx负载均衡配置
Nginx负载均衡配置
发布时间:2019/1/19 0:00:00

Nginx负载均衡配置,主要是proxy_pass,upstream的使用

在http段做如配置,即可实现 

upstream www.xxx.com
{
server 10.0.1.50:8080;
server 10.0.1.51:8080;
}

upstream blog.xxx.com
{
server 10.0.1.50:8080;
server 10.0.1.51:8080;
}

server
{
listen 80;
server_name www.xxx.com;

location / {
proxy_pass http://www.xxx.com
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}

server
{
listen 80;
server_name blog.xxx.com wode.xxx.com;

location / {
proxy_pass http://www.xxx.com
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}

数千企业与站长的选择,7*24小时稳定运行

 了解更多套餐详细
  • 销售1
  • 点击这里给我发消息
  • 销售2
  • 点击这里给我发消息
  • 优惠码订阅
  • 填写您的邮件地址,订阅我们的精彩内容: