<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組合實(shí)現(xiàn)均衡(我就當(dāng)它是把80跟其他端口組合起來(lái)):)

    Nginx ("engine x") 是一個(gè)高性能的 HTTP 和 反向代理 服務(wù)器,也是一個(gè) IMAP/POP3/SMTP 代理服務(wù)器 。 Nginx 是由 Igor Sysoev 為俄羅斯訪問(wèn)量第二的Rambler.ru 站點(diǎn)開(kāi)發(fā)的,它已經(jīng)在該站點(diǎn)運(yùn)行超過(guò)四年多了。Igor 將源代碼以類(lèi)BSD許可證的形式發(fā)布。自Nginx 發(fā)布四年來(lái),Nginx 已經(jīng)因?yàn)樗姆€(wěn)定性、豐富的功能集、 示例配置文件和低系統(tǒng)資源的消耗而聞名了。目前國(guó)內(nèi)各大門(mén)戶(hù)網(wǎng)站已經(jīng)部署了Nginx,如新浪、網(wǎng)易、騰訊等;國(guó)內(nèi)幾個(gè)重要的視頻分享網(wǎng)站也部署了Nginx,如六房間、酷6等。 新近發(fā)現(xiàn)Nginx 技術(shù)在國(guó)內(nèi)日趨火熱,越來(lái)越多的網(wǎng)站開(kāi)始部署Nginx。

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

    這個(gè)模塊提供一個(gè)簡(jiǎn)單方法來(lái)實(shí)現(xiàn)在輪詢(xún)和客戶(hù)端IP之間的后端服務(wù)器負(fù)荷平衡。

    配置范例:

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

    配置指導(dǎo)
    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; 
    #這里才是實(shí)現(xiàn)均衡的地方,一般做法 Nginx 對(duì)外, 內(nèi)部對(duì)應(yīng)多臺(tái) server 有點(diǎn)像映射。。。
        }
        
        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
    ;
            }
    #這里配置過(guò)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 閱讀(387) 評(píng)論(0)  編輯  收藏 所屬分類(lèi): server


    只有注冊(cè)用戶(hù)登錄后才能發(fā)表評(píng)論。


    網(wǎng)站導(dǎo)航:
     
    主站蜘蛛池模板: 亚洲av永久无码精品网址| 丝袜足液精子免费视频| 亚洲成a人一区二区三区| 国产97视频人人做人人爱免费| 久久香蕉国产线看观看亚洲片| 黄页网站在线看免费| 又硬又粗又长又爽免费看| 精品日韩亚洲AV无码一区二区三区 | 久久国产乱子伦精品免费强| 99久久国产亚洲综合精品| 国产亚洲成AV人片在线观黄桃 | 国产成人精品免费视频动漫| 偷自拍亚洲视频在线观看99| 91天堂素人精品系列全集亚洲| 精品久久免费视频| 无码少妇精品一区二区免费动态| 337P日本欧洲亚洲大胆精品| 精品亚洲成a人片在线观看少妇 | 亚洲综合熟女久久久30p| 中文字幕av无码无卡免费| 成全视成人免费观看在线看| 亚洲另类无码专区丝袜| 久久亚洲精品AB无码播放| 免费一级e一片在线播放| 欧美在线看片A免费观看| 久久久高清日本道免费观看| 美女被暴羞羞免费视频| 亚洲人成在线中文字幕| 亚洲avav天堂av在线不卡| 亚洲国产精品日韩| 免费羞羞视频网站| 青青青国产在线观看免费| 可以免费观看的国产视频| 日韩电影免费在线观看网址| 亚洲精品无码专区在线播放| 亚洲午夜电影一区二区三区| 亚洲大尺度无码专区尤物| 亚洲精品动漫人成3d在线| 啦啦啦www免费视频| 免费中文熟妇在线影片| 91高清免费国产自产|