美文网首页
Nginx负载均衡

Nginx负载均衡

作者: Kosh | 来源:发表于2017-02-23 11:40 被阅读14次

在http下server前加上

upstream  mcs  {
        server   10.0.0.10:8080  weight=1 max_fails=3 fail_timeout=30s;
        server   10.0.0.13:8080  weight=1 max_fails=3 fail_timeout=30s;
    }

修改

server {
        listen       80;
        server_name  mcs;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

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

相关文章

网友评论

      本文标题:Nginx负载均衡

      本文链接:https://www.haomeiwen.com/subject/csavwttx.html