<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    Vanlin Study Club

    Java Js Flex

    Nginx 0.8.x跟tomcat組合實現均衡(我就當它是把80跟其他端口組合起來):)

    Nginx ("engine x") 是一個高性能的 HTTP 和 反向代理 服務器,也是一個 IMAP/POP3/SMTP 代理服務器 。 Nginx 是由 Igor Sysoev 為俄羅斯訪問量第二的Rambler.ru 站點開發的,它已經在該站點運行超過四年多了。Igor 將源代碼以類BSD許可證的形式發布。自Nginx 發布四年來,Nginx 已經因為它的穩定性、豐富的功能集、 示例配置文件和低系統資源的消耗而聞名了。目前國內各大門戶網站已經部署了Nginx,如新浪、網易、騰訊等;國內幾個重要的視頻分享網站也部署了Nginx,如六房間、酷6等。 新近發現Nginx 技術在國內日趨火熱,越來越多的網站開始部署Nginx。

    這么好的東西不用用不行啊,,,來看官方的文檔。
    NginxChsHttpUpstreamModule
    Edit section: 摘要 摘要

    這個模塊提供一個簡單方法來實現在輪詢和客戶端IP之間的后端服務器負荷平衡。

    配置范例:

    upstream backend  {
      server backend1.example.com weight
    =5;
      server backend2.example.com:8080;
      server unix:/tmp/backend3;
    }
     
    server {
      location / {
        proxy_pass  http://backend
    ;
      }
    }

    配置指導
    Edit section: ip_hash ip_hash

    syntax: ip_hash

    default: none

    context: upstream

    This directive causes requests to be distributed between upstreams based on the IP-address of the client. The key for the hash is the class-C network address of the client. This method guarantees that the client request will always be transferred to the same server. But if this server is considered inoperative
    , then the request of this client will be transferred to another server. This gives a high probability clients will always connect to the same server.

    范例:

    upstream backend {
      ip_hash
    ;
      server   backend1.example.com;
      server   backend2.example.com;
      server   backend3.example.com  down;
      server   backend4.example.com;
    }

    Edit section: server server

    syntax: server name 
    [parameters]

    default: none

    context: upstream 

    看不出名堂?不要緊看我的 配置最直觀 nginx.conf

    #user  nobody
    ;
    worker_processes  1;

    #error_log  logs/error.log
    ;
    #error_log  logs/error.log  notice;
    #error_log  logs/error.log  info;

    #pid        logs/nginx.pid
    ;


    events {
        worker_connections  
    1024;
    }


    http {
        include       mime.types
    ;
        default_type  application/octet-stream;

        #log_format  main  '$remote_addr - $remote_user 
    [$time_local] "$request" '
        #                  '$status $body_bytes_sent 
    "$http_referer" '
        #                  '
    "$http_user_agent" "$http_x_forwarded_for"';

        #access_log  logs/access.log  main
    ;
        upstream vanlin.imblog.in { 
          server 
    127.0.0.1:8080; 
    #這里才是實現均衡的地方,一般做法 Nginx 對外, 內部對應多臺 server 有點像映射。。。
        }
        
        sendfile        on
    ;
        #tcp_nopush     on;

        #keepalive_timeout  
    0;
        keepalive_timeout  65;

        #gzip  on
    ;

        server {
            listen       
    80;
            server_name  vanlin.imblog.in;

            #charset koi8-r
    ;

            #access_log  logs/host.access.log  main
    ;

            location / {
                proxy_pass http://vanlin.imblog.in
    ;
                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  
    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
    ;
            }
    #這里配置過php,,好像。。 需要 php_cgi  的支持
            # proxy the PHP scripts to Apache listening on 
    127.0.0.1:80
            #
            #location ~ \.php$ {
            #    proxy_pass   http://
    127.0.0.1;
            #}

            # pass the PHP scripts to FastCGI server listening on 
    127.0.0.1:9000
            #
            #location ~ \.php$ {
            #    root           html
    ;
            #    fastcgi_pass   127.0.0.1:9000;
            #    fastcgi_index  index.php;
            #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
            #    include        fastcgi_params;
            #}

            # deny access to .htaccess files
    , if Apache's document root
            # concurs with nginx's one
            #
            #location ~ /\.ht {
            #    deny  all
    ;
            #}
        }


        # another virtual host using mix of IP-
    , name-, and port-based configuration
        #
        #server {
        #    listen       
    8000;
        #    listen       somename:8080;
        #    server_name  somename  alias  another.alias;

        #    location / {
        #        root   html
    ;
        #        index  index.html index.htm;
        #    }
        #}


        # HTTPS server
        #
        #server {
        #    listen       
    443;
        #    server_name  localhost;

        #    ssl                  on
    ;
        #    ssl_certificate      cert.pem;
        #    ssl_certificate_key  cert.key;

        #    ssl_session_timeout  5m
    ;

        #    ssl_protocols  SSLv2 SSLv3 TLSv1
    ;
        #    ssl_ciphers  ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
        #    ssl_prefer_server_ciphers   on;

        #    location / {
        #        root   html
    ;
        #        index  index.html index.htm;
        #    }
        #}

    }

    posted on 2009-10-14 11:05 vanlin 閱讀(386) 評論(0)  編輯  收藏 所屬分類: server


    只有注冊用戶登錄后才能發表評論。


    網站導航:
     
    主站蜘蛛池模板: 国产成人精品免费视频大全五级 | 久久久久亚洲AV成人片| 欧洲精品码一区二区三区免费看| 成人免费看吃奶视频网站| 亚洲伊人久久大香线蕉在观| 免免费国产AAAAA片| 亚美影视免费在线观看| 亚洲国产精品无码久久青草| 亚洲电影国产一区| 久久狠狠躁免费观看2020| 亚洲AV无码国产精品色午友在线| 男人j进入女人j内部免费网站| 亚洲av综合avav中文| 91精品手机国产免费| 亚洲午夜久久久久久尤物| 女人被男人躁的女爽免费视频| 黑人粗长大战亚洲女2021国产精品成人免费视频 | 亚洲天堂2016| 青青草国产免费久久久下载| 久久亚洲精品11p| 4444www免费看| 亚洲砖码砖专无区2023| 国产免费卡一卡三卡乱码| v片免费在线观看| 久久久亚洲精品视频| 免费无码A片一区二三区| 苍井空亚洲精品AA片在线播放| 免费国产成人午夜私人影视| 国产在线观a免费观看| 亚洲精品国产成人| 国产小视频在线观看免费| 两性色午夜免费视频| 亚洲毛片免费视频| 国产成人综合久久精品免费| 在线人成免费视频69国产| 亚洲AV无码久久久久网站蜜桃| 免费无码毛片一区二区APP| 中文字幕亚洲精品无码| 久久亚洲高清综合| 色播精品免费小视频| 成人午夜免费视频|