国产精品国产三级国产试看,香蕉人精品视频多人免费永久视频,宅男噜噜噜66一区二区,天天插天天射,女人体(1963)菠萝蜜视频,97在线视频人妻无码一区,精品久久久久精品色婷婷综合

網(wǎng)站首頁(yè)
手機(jī)版

nginx負(fù)載均衡配置-windows nginx負(fù)載均衡配置,當(dāng)前機(jī)器宕機(jī)

更新時(shí)間:2024-06-02 00:08:17作者:未知

nginx負(fù)載均衡配置-windows nginx負(fù)載均衡配置,當(dāng)前機(jī)器宕機(jī)

nginx負(fù)載均衡配置-windows

雖然說(shuō)windows上的nginx在官方文檔中提到"僅作為測(cè)試"之用,但對(duì)于小規(guī)模并發(fā)場(chǎng)景還是比apache有不小的優(yōu)勢(shì)。所以,本文也將其作為windows服務(wù)器上負(fù)載均衡的主要工具進(jìn)行說(shuō)明。

配置實(shí)例

#user nobody;

#指定nginx進(jìn)程數(shù),通常與CPU數(shù)相一致。特別是在windows平臺(tái)中,這一數(shù)值一般只能設(shè)置為1.

worker_processes 1;

#error_log logs/error.log;

#error_log logs/error.log notice;

#error_log logs/error.log info;

#pid logs/nginx.pid;

events {

# windows平臺(tái)基本只能設(shè)置為1024

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;

# 如果應(yīng)用未使用文件傳遞,則可關(guān)閉此項(xiàng)。

sendfile off;

#tcp_nopush on;

keepalive_timeout 15;

#gzip on;

# HTTPS server

upstream cas_servers {

#使用C類(lèi)網(wǎng)絡(luò)中的IP HASH方式進(jìn)行負(fù)載分流

ip_hash;

server 127.0.0.1:8400 weight=1;

server 127.0.0.1:8401 weight=1;

# server 127.0.0.1:8402 weight=1;

}

server {

listen 80;

server_name 192.168.50.30;

location / {

proxy_pass http://127.0.0.1:9000$request_uri;

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 443;

server_name example.;

ssl on;

ssl_certificate ssl.crt;

# 與apache類(lèi)似,nginx也不使用有密碼的ssl key

ssl_certificate_key ssl-nokey.key;

ssl_session_timeout 5m;

ssl_protocols SSLv2 SSLv3 TLSv1;

#ssl_ciphers HIGH:!aNULL:!MD5

ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;

ssl_prefer_server_ciphers on;

#雙向認(rèn)證

#ssl_client_certificate ca.crt;

#雙向認(rèn)證

ssl_verify_client off;

location / {

proxy_pass http://cas_servers$request_uri;

# 將client端傳遞過(guò)來(lái)的HTTP Host轉(zhuǎn)發(fā)給給后端 Web AppServer

proxy_set_header Host $host;

# 傳遞client端的真實(shí)IP,但如果后端 Web AppServer 沒(méi)有對(duì)此進(jìn)行專門(mén)處理,也沒(méi)啥作用

proxy_set_header X-Real-IP $remote_addr;

proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

# 如果使用了 SSL,則將HTTP SSL_CERT 參數(shù)轉(zhuǎn)發(fā)給后端 Web AppServer

proxy_set_header SSL_CERT $ssl_client_cert;

}

}

}

本文標(biāo)簽: 后端  設(shè)置為  雙向