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

歡迎來到夢(mèng)飛科技

服務(wù)器租用

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

Nginx設(shè)置負(fù)載平衡進(jìn)程及代碼分享,負(fù)載平衡實(shí)現(xiàn)道理

 負(fù)載平衡是我們大流量網(wǎng)站要做的一個(gè)對(duì)象,下面我來給各人先容在NGINX處事器長(zhǎng)舉辦負(fù)載平衡設(shè)置要領(lǐng),但愿對(duì)有需要的同學(xué)有所輔佐哦。負(fù)載平衡先來簡(jiǎn)樸相識(shí)一下什么是負(fù)載平衡,單從字面上的意思來領(lǐng)略就可以表明N臺(tái)處事器平均分管負(fù)載,不會(huì)因?yàn)槟撑_(tái)處事器負(fù)載高宕機(jī)而某臺(tái)處事器閑置的環(huán)境。那么負(fù)載平衡的前提就是要有多臺(tái)處事器才氣實(shí)現(xiàn),也就是兩臺(tái)以上即可。

直接上樂成的參數(shù),實(shí)現(xiàn)了本機(jī)平衡并本機(jī)的NGINX也用起來:

A、主NGINX:

#user nobody;
worker_processes 1;

#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;

pid /var/run/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;

 sendfile on;
 #tcp_nopush on;

 #keepalive_timeout 0;
 keepalive_timeout 65;
 #gzip on;

upstream a.com{
# hash $cookie_jsessionid;
 hash $remote_addr consistent;
 server 192.168.142.128:8080 weight=3;
 server 192.168.142.129:80 weight=10;
# hash $cookie_jsessionid;
# server 192.168.142.130:80;
# ip_hash;
# hash_again 1;
# consistent_hash $remote_addr:可以按照客戶端ip映射
# consistent_hash $request_uri: 按照客戶端請(qǐng)求的uri映射
# consistent_hash $args:按照客戶端攜帶的參數(shù)舉辦映射
 }
server{
 listen 80;
 server_name a.com;
 location / {
 index index.html;
 root /usr/html;
 proxy_pass http://a.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;
 }

}

 server {
 listen 8080;
 server_name a.com;

 #access_log logs/host.access.log main;

 location / {
 root html;
 index index.html index.htm index.php;
 }

location ~ .*.(php|php5)?$
{
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /var/www/blog$fastcgi_script_name;
include fastcgi.conf;
}

location ~ .*.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}

location ~ .*.(js|css)?$
{
expires 12h;
}

access_log off;


 #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;
 # }
 #}

}

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

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

主站蜘蛛池模板: 子长县| 缙云县| 宁德市| 靖边县| 青海省| 邹平县| 潮州市| 高邮市| 定州市| 会理县| 乌鲁木齐市| 中超| 夏河县| 赤壁市| 岢岚县| 乐安县| 平武县| 湘西| 桐庐县| 克山县| 普陀区| 左云县| 松滋市| 常德市| 三门峡市| 芦山县| 安仁县| 永定县| 隆化县| 乳源| 桓仁| 关岭| 基隆市| 蒙阴县| 乐东| 江阴市| 普定县| 兴化市| 壤塘县| 黎城县| 上栗县|