天天看点

nginx 反向代理 负载均衡配置

nginx 反向代理:

location ~ \.(jpeg|jpg|png|gif)${

    proxy_pass http://192.168.2.42:80;

    proxy_set_header X-Forwarded-For $remote_addr;

}

负载均衡:

upstream imageserver{

    server 192.168.1.204:80 weight=1 max_fails=2 fail_timeout=30

    server 192.168.1.202:80 weight=1 max_fails=2 fail_timeout=30

    server 192.168.1.203:80 weight=1 max_fails=2 fail_timeout=30

}

location ~ \.(jpeg|jpg|png|gif)${

    proxy_pass http://imgserver;

    proxy_set_header X-Forwarded-For $remote_addr;

}

继续阅读