亚洲视频二区_亚洲欧洲日本天天堂在线观看_日韩一区二区在线观看_中文字幕不卡一区

公告:魔扣目錄網(wǎng)為廣大站長提供免費(fèi)收錄網(wǎng)站服務(wù),提交前請做好本站友鏈:【 網(wǎng)站目錄:http://www.430618.com 】, 免友鏈快審服務(wù)(50元/站),

點(diǎn)擊這里在線咨詢客服
新站提交
  • 網(wǎng)站:51998
  • 待審:31
  • 小程序:12
  • 文章:1030137
  • 會員:747

Nginx web負(fù)載均衡配置

下載nginx

  • http://nginx.org/en/download.html
wget http://nginx.org/download/nginx-1.20.2.tar.gz

安裝nginx

  • 參考: https://www.cnblogs.com/-wei/p/15219624.html
./configure --prefix=/opt/nginx
或
./configure --prefix=/opt/nginx --with-http_ssl_module
make
make install

報(bào)錯(cuò)

  • ./configure: error: the HTTP rewrite module requires the PCRE library
yum -y install pcre-devel
  • ./configure: error: the HTTP gzip module requires the zlib library.
yum -y install zlib-devel
  • ./configure: error: SSL modules require the OpenSSL library.
yum -y install openssl openssl-devel

nginx限制請求數(shù)據(jù)包大小

client_max_body_size 1000m;

負(fù)載均衡配置

  • 參考: https://www.cnblogs.com/telwanggs/p/14977290.html
  upstream test_group {
        # If there is no specific strategy, round-robin
        #     would be the default strategy.
        # least_conn;
        # ip_hash;
        server 172.16.217.109:8501 weight=1 max_fails=2 fail_timeout=30s;
        server 172.16.217.109:8502 weight=1 max_fails=2 fail_timeout=30s;
    }
    
    location / {
            #root   html;
            #index  index.html index.htm;
            client_max_body_size 3m;
            proxy_pass http://test_group;
    }

nginx負(fù)載均衡策略

  • 輪詢:將客戶端發(fā)起的請求,平均分配給每一臺服務(wù)器
  • 權(quán)重:將客戶的的請求,根據(jù)服務(wù)器的權(quán)重值不同,分配不同的數(shù)量
  • ip_hash:基于發(fā)起請求的客戶端的ip地址不同,他始終會將請求發(fā)送到指定的服務(wù)器上,客戶端ip地址不變,就會一直發(fā)送到一個(gè)服務(wù)器上。

輪詢

upstream my_server{
    server IP:8080;
    server IP:8081;
}
server {
    listen       80;
    listen  [::]:80;
    server_name  localhost;

    location / {
        proxy_pass http://my_server/;
    }
}

權(quán)重

upstream my_server{
    server IP:8080 weight=10;
    server IP:8081 weight=2;
}
server {
    listen       80;
    listen  [::]:80;
    server_name  localhost;

    location / {
        proxy_pass http://my_server/;
    }
}

ip_hash

upstream my_server{
    ip_hash;
    server IP:8080 weight=10;
    server IP:8081 weight=2;
}
server {
    listen       80;
    listen  [::]:80;
    server_name  localhost;

    location / {
        proxy_pass http://my_server/;
    }
}

分享到:
標(biāo)簽:nginx
用戶無頭像

網(wǎng)友整理

注冊時(shí)間:

網(wǎng)站:5 個(gè)   小程序:0 個(gè)  文章:12 篇

  • 51998

    網(wǎng)站

  • 12

    小程序

  • 1030137

    文章

  • 747

    會員

趕快注冊賬號,推廣您的網(wǎng)站吧!
最新入駐小程序

數(shù)獨(dú)大挑戰(zhàn)2018-06-03

數(shù)獨(dú)一種數(shù)學(xué)游戲,玩家需要根據(jù)9

答題星2018-06-03

您可以通過答題星輕松地創(chuàng)建試卷

全階人生考試2018-06-03

各種考試題,題庫,初中,高中,大學(xué)四六

運(yùn)動(dòng)步數(shù)有氧達(dá)人2018-06-03

記錄運(yùn)動(dòng)步數(shù),積累氧氣值。還可偷

每日養(yǎng)生app2018-06-03

每日養(yǎng)生,天天健康

體育訓(xùn)練成績評定2018-06-03

通用課目體育訓(xùn)練成績評定