欧美一区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號

主站蜘蛛池模板: 刚察县| 施甸县| 越西县| 洮南市| 临桂县| 紫云| 翁牛特旗| 张家港市| 萍乡市| 长泰县| 遂溪县| 马龙县| 习水县| 仙桃市| 江口县| 永春县| 育儿| 扎囊县| 威远县| 合川市| 安溪县| 崇义县| 长岭县| 昌邑市| 中卫市| 德安县| 成武县| 阿拉尔市| 济阳县| 大邑县| 乡宁县| 普宁市| 泸定县| 京山县| 华亭县| 万宁市| 贵阳市| 桦川县| 宁蒗| 巨野县| 新营市|