日韩无码专区无码一级三级片|91人人爱网站中日韩无码电影|厨房大战丰满熟妇|AV高清无码在线免费观看|另类AV日韩少妇熟女|中文日本大黄一级黄色片|色情在线视频免费|亚洲成人特黄a片|黄片wwwav色图欧美|欧亚乱色一区二区三区

RELATEED CONSULTING
相關(guān)咨詢
選擇下列產(chǎn)品馬上在線溝通
服務(wù)時(shí)間:8:30-17:00
你可能遇到了下面的問題
關(guān)閉右側(cè)工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
Ubuntu下實(shí)現(xiàn)Nginx負(fù)載均衡

企業(yè)在解決高并發(fā)問題時(shí),一般有兩個(gè)方向的處理策略,軟件、硬件,硬件上添加負(fù)載均衡器分發(fā)大量請求,軟件上可在高并發(fā)瓶頸處:數(shù)據(jù)庫+web服務(wù)器兩處添加解決方案,其中web服務(wù)器前面一層最常用的的添加負(fù)載方案就是使用nginx實(shí)現(xiàn)負(fù)載均衡。

環(huán)境

ubuntu 16.04.3 LTS

ginx version: nginx/1.10.3 (Ubuntu)

注:本文部分參數(shù)僅供參考,請按照實(shí)際環(huán)境進(jìn)行更改。

負(fù)載均衡配置

root@ubuntu-vhost:vim /etc/nginx/sites-enabled/default


upstream domain.com {

       server 172.xxx.xxx.xx:80 max_fails=1 fail_timeout=120s;

       server 172.xxx.xxx.xx:80 max_fails=1 fail_timeout=120s;

}

server {

       listen 80;

       server_name www.domain.com domain.com;

       location / {

               proxy_next_upstream  http_500 http_502 http_503 http_504 http_404;

               proxy_connect_timeout  30s;

               proxy_read_timeout     30s;

               proxy_pass http://domain.com;

               proxy_set_header    Host             $host;

               proxy_set_header    X-Real-IP        $remote_addr;

               proxy_set_header    X-Forwarded-For  $proxy_add_x_forwarded_for;

               proxy_set_header    HTTP_X_FORWARDED_FOR $remote_addr;

               proxy_redirect      default;

             }

}

#############################################################

說明:

max_fails=1 fail_timeout=120s;  用于判斷后端節(jié)點(diǎn)狀態(tài),所用到兩個(gè)參數(shù),由 proxy_next_upstream 或 fastcgi_next_upstream 指定。而且可以使用 proxy_connect_timeout 和 proxy_read_timeout 控制 upstream 響應(yīng)時(shí)間。

proxy_next_upstream http_500 | http_502 | http_503 | http_504 |http_404;當(dāng)其中一臺返回錯(cuò)誤碼404,500...等錯(cuò)誤時(shí),可以分配到下一臺服務(wù)器程序繼續(xù)處理,提高平臺訪問成功率,多可運(yùn)用于前臺程序負(fù)載

proxy_read_timeout 請參照 php.ini 中的 max_execution_time 選項(xiàng)值

新聞標(biāo)題:Ubuntu下實(shí)現(xiàn)Nginx負(fù)載均衡
文章分享:http://m.5511xx.com/article/dhogsjj.html