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

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

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

    posts - 68, comments - 19, trackbacks - 0, articles - 1

    nginx負載均衡配置

    Posted on 2018-09-15 23:08 viery 閱讀(141) 評論(0)  編輯  收藏 所屬分類: linux
    1.準備3臺服務器,可以在虛擬機上測試,都要安裝nginx 
    c01 nginx負載均衡服務器 192.168.38.128
    c02 c03 web服務器 192.168.38.129/130

    2.c02 c03 nginx.conf配置
     1 worker_processes  1;
     2 error_log logs/error.log;
     3 events {
     4     worker_connections  1024;
     5 }
     6 http {
     7     include       mime.types;
     8     default_type  application/octet-stream;
     9     log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
    10                       '$status $body_bytes_sent "$http_referer" '
    11                       '"$http_user_agent" "$http_x_forwarded_for"';
    12 
    13     sendfile        on;
    14     server_tokens off;
    15     keepalive_timeout  65;
    16     
    17     server {
    18         listen       80;
    19         server_name  www.hello.org;
    20 
    21         location / {
    22             root   html/www;
    23             index  index.html index.htm;
    24         }
    25         access_log logs/access_www.log main;
    26     }
    27 }

    3 /ect/hosts 配置ip和域名對應

    4 curl測試web服務器解析結果是否正確

    5.配置負載均衡服務器
     1 worker_processes  1;
     2 error_log logs/error.log;
     3 events {
     4     worker_connections  1024;
     5 }
     6 http {
     7     include       mime.types;
     8     default_type  application/octet-stream;
     9 
    10     log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
    11                       '$status $body_bytes_sent "$http_referer" '
    12                       '"$http_user_agent" "$http_x_forwarded_for"';
    13 
    14     sendfile        on;
    15     server_tokens off;
    16     keepalive_timeout  65;
    17     upstream www_server_pools{
    18         server 192.168.38.130:80 weight=1;
    19         server 192.168.38.129:80 weight=1;
    20     }
    21     server{
    22         listen 80;
    23         server_name www.hello.org;
    24         location / {
    25                 proxy_pass http://www_server_pools;
    26         }
    27     }
    28 }

    6.在windows客戶端配置etc目錄下域名解析 
    192.168.38.128 www.hello.org

    在瀏覽器中輸入www.hello.org,會按照配置文件中的weight比例交替出現c02和c03web服務器。
    主站蜘蛛池模板: a级毛片高清免费视频| 国产大片免费网站不卡美女| 国产中文字幕在线免费观看| 国产三级免费观看| 日韩在线视精品在亚洲| 免费人成在线观看视频播放 | 最近免费字幕中文大全| 日韩亚洲变态另类中文| 亚洲宅男精品一区在线观看| 亚洲欧洲免费无码| 亚洲日韩国产AV无码无码精品| 两个人www免费高清视频| 久久综合AV免费观看| 久久亚洲精品高潮综合色a片| 91久久精品国产免费一区| 亚洲精品亚洲人成在线麻豆| 美女视频黄免费亚洲| 亚洲AV网一区二区三区| 亚洲熟女乱综合一区二区| 久久99热精品免费观看动漫| 亚洲人和日本人jizz| 在线观看免费为成年视频| 一级毛片免费一级直接观看| 久久精品国产亚洲av麻豆| 久久精品无码一区二区三区免费| 国产精品亚洲专区无码唯爱网| 亚洲日韩在线中文字幕第一页| 免费精品99久久国产综合精品| 亚洲va乱码一区二区三区| 国产三级免费观看| 四虎国产精品永久免费网址 | 久久久久免费看黄a级试看| 亚洲依依成人精品| 一本色道久久88亚洲综合| 亚洲色偷偷综合亚洲av78| 波多野结衣中文一区二区免费| 国产精品网站在线观看免费传媒 | 色偷偷亚洲女人天堂观看欧| 亚洲精品视频免费| 很黄很黄的网站免费的| eeuss影院免费直达入口|