nginx配置负载均衡

来源:互联网 发布:淘宝外观专利投诉流程 编辑:程序博客网 时间:2024/06/07 06:32

主要配置nginx.conf文件

红色字体的为核心配置,其它的按你自己的来。

#user  nobody;
worker_processes  1;

events {
    worker_connections  1024;
}


http {
    include       mime.types;
    default_type  application/octet-stream;
    sendfile        on;
    keepalive_timeout  65;

    upstream test.com {  
       server 192.168.99.110:8888;  
       server 192.168.99.165:8888;  
    } 

    server {
        listen       8080;
        
        server_name test.com;
       
        location / {
            root   html;
   proxy_pass http://test.com;
            index  index.html index.htm;
        }


        #error_page  404              /404.html;


        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        } 
    }
    include servers/*;
}


原创粉丝点击