欧美一区2区三区4区公司二百,国产精品婷婷午夜在线观看,自拍偷拍亚洲精品,国产美女诱惑一区二区

歡迎來到夢飛科技

服務(wù)器租用

當(dāng)前優(yōu)惠活動(dòng):

nginx集群設(shè)置設(shè)置負(fù)載平衡時(shí)的靜態(tài)文件處理懲罰方法

我在本機(jī)裝了3個(gè)虛擬機(jī),

3個(gè)虛擬機(jī)都陳設(shè)了溝通的項(xiàng)目

地點(diǎn)別離為 

    192.168.20.133:8080

    192.168.20.135:8080

    192.168.20.136:8080

ngxin安裝在133上,directadmin安裝 directadmin漢化集群設(shè)置如下

nginx集群配置配置負(fù)載均衡時(shí)的靜態(tài)文件處理懲罰處罰要領(lǐng)

因?yàn)槲?35 136 的權(quán)重為2, 133的權(quán)重為1 ,

我開著3個(gè)日志, 每次會見到哪個(gè)呆板,日志會有轉(zhuǎn)動(dòng)來確定會見到哪臺虛擬機(jī)了

一般順序?yàn)?135 136 135 136 133   135 136 135 136 133    135 136 135 136 133   但也不停對

我把136的tomcat遏制之后, 133 和135可以或許繼承提供處事,擔(dān)保一臺處事器掛掉之后其他處事器繼承事情。

nginx集群配置配置負(fù)載均衡時(shí)的靜態(tài)文件處理懲罰處罰要領(lǐng)

靜態(tài)文件交給nginx處理懲罰設(shè)置如下

/usr/nginxStaticFile 目次下 的靜態(tài)文件, 等同于 tomcat/webapps/projectname 里的靜態(tài)文件

location ~\.(gif|jpg|jpeg|png|css|js)$ {
        root /usr/nginxStaticFile;
        expires  2h;
         }

所有設(shè)置:

#user  nobody;
worker_processes  1;
error_log  /usr/nginxLog/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;
#pid       /usr/nginxLog/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;
    access_log /usr/nginxLog/access.log;
    sendfile        on;
    #tcp_nopush     on;
    #keepalive_timeout  0;
    keepalive_timeout  65;
    #gzip  on;
 #upstream作負(fù)載平衡,在此設(shè)置需要輪詢的處事器地點(diǎn)和端標(biāo)語,max_fails為答允請求失敗的次數(shù),默認(rèn)為1.
    #weight為輪詢權(quán)重,按照差異的權(quán)重分派可以用來均衡處事器的會見率。
    upstream hostname {
        server 192.168.20.133:8080 max_fails=0 weight=1;
        server 192.168.20.135:8080 max_fails=0 weight=2;
server 192.168.20.136:8080 max_fails=0 weight=2;
    }
    server {
        listen       80;
        server_name  localhost;
        #charset koi8-r;
        #access_log  logs/host.access.log  main;
        location / {
            #root   html;
            #index  index.html index.htm;
            proxy_pass http://hostname;
    proxy_set_header  X-Real-IP $remote_addr;
        }
  location ~\.(gif|jpg|jpeg|png|css|js)$ {
        root /usr/nginxStaticFile;
        expires  2h;
         }
   #啟用nginx status 監(jiān)聽頁面
        location /nginxstatus {
            stub_status on;
            access_log on;
        }
        #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;
        }
        # 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 ssl;
    #    server_name  localhost;
    #    ssl_certificate      cert.pem;
    #    ssl_certificate_key  cert.key;
    #    ssl_session_cache    shared:SSL:1m;
    #    ssl_session_timeout  5m;
    #    ssl_ciphers  HIGH:!aNULL:!MD5;
    #    ssl_prefer_server_ciphers  on;
    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}
}

夢飛科技 - 全球數(shù)據(jù)中心基礎(chǔ)服務(wù)領(lǐng)先供應(yīng)商

Copyright © 2003-2019 MFISP.COM. 國外服務(wù)器租用 IDC公司 版權(quán)所有 ? 粵ICP備11019662號

主站蜘蛛池模板: 象山县| 永春县| 鲁甸县| 灵宝市| 灌阳县| 郴州市| 尼木县| 萨嘎县| 柳江县| 谷城县| 漳州市| 清水河县| 阜南县| 北川| 云浮市| 道真| 江津市| 吉林省| 平山县| 德庆县| 岳普湖县| 红河县| 正定县| 泗洪县| 洞口县| 关岭| 武乡县| 仙居县| 浦江县| 万盛区| 都江堰市| 探索| 朝阳区| 廊坊市| 乌拉特前旗| 庆云县| 确山县| 荆门市| 铁岭县| 高邑县| 高台县|