<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 閱讀(143) 評論(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服務器。
    主站蜘蛛池模板: 免费一级特黄特色大片在线| 在线视频精品免费| 国产又粗又猛又爽又黄的免费视频| 亚洲欧洲日本天天堂在线观看| 日韩精品无码免费专区网站| 国产亚洲精品无码成人| 久久av免费天堂小草播放| 亚洲偷自拍拍综合网| 五月婷婷免费视频| 中文字幕亚洲日韩无线码| 一个人晚上在线观看的免费视频| 亚洲国产精品国产自在在线| 一道本不卡免费视频| 亚洲?V乱码久久精品蜜桃| 国产高清对白在线观看免费91| 亚洲伊人成无码综合网 | 亚洲国产成人久久精品app| 日日麻批免费40分钟无码| 亚洲黄色在线播放| 久久99九九国产免费看小说| 亚洲成av人无码亚洲成av人| 国产免费AV片无码永久免费| 久久久久久久久久免免费精品| 亚洲AV日韩AV鸥美在线观看| 91精品视频免费| 国产午夜亚洲精品不卡电影| 亚洲性在线看高清h片| 国产成人免费视频| 亚洲videos| 国产大片免费观看中文字幕| 国产精品免费一区二区三区| 亚洲欧洲日韩国产综合在线二区| 国产乱码免费卡1卡二卡3卡| 男男gay做爽爽免费视频| 国产亚洲福利精品一区| 久久99九九国产免费看小说| 人妻18毛片a级毛片免费看| 在线观看亚洲一区二区| 日本免费电影一区| 国产一级淫片a免费播放口| 中文无码亚洲精品字幕|