nginx負載均衡配置(整理)

編輯nginx.conf

upstream app{

    server 172.17.12.2:8080;

    server 172.17.12.3:8080;

    server 172.17.12.4:8080;

}

server {

    listen 8080;

    server_name localhost;



    #charset koi8-r;

    #access_log /var/log/nginx/log/host.access.log main;

    location / {

        root /usr/share/nginx/html;

        index index.html index.htm;

    }

    # set site favicon

    location /favicon.ico {

        log_not_found off;

        access_log off;

    }


    location /search {

        proxy_pass http://app/search;

        #proxy_redirect default;

        proxy_connect_timeout 600;
    
        proxy_read_timeout 600;

        proxy_send_timeout 600;

        proxy_set_header Host $host;

        proxy_set_header X-Real-IP $remote_addr;

        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

    }




    error_page 500 502 503 504 /50x.html;

    location = /50x.html {

        root /usr/share/nginx/html;

    }



}

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章