国产精品吹潮在线播放,日韩一区二区三区在线播放,啊级免费黄片视频,66av视频

nginx負載均衡配置-windows nginx負載均衡配置,當前機器宕機

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

nginx負載均衡配置-windows nginx負載均衡配置,當前機器宕機

nginx負載均衡配置-windows

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

配置實例

#user nobody;

#指定nginx進程數(shù),通常與CPU數(shù)相一致。特別是在windows平臺中,這一數(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平臺基本只能設置為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;

# 如果應用未使用文件傳遞,則可關閉此項。

sendfile off;

#tcp_nopush on;

keepalive_timeout 15;

#gzip on;

# HTTPS server

upstream cas_servers {

#使用C類網(wǎng)絡中的IP HASH方式進行負載分流

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類似,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;

#雙向認證

#ssl_client_certificate ca.crt;

#雙向認證

ssl_verify_client off;

location / {

proxy_pass http://cas_servers$request_uri;

# 將client端傳遞過來的HTTP Host轉發(fā)給給后端 Web AppServer

proxy_set_header Host $host;

# 傳遞client端的真實IP,但如果后端 Web AppServer 沒有對此進行專門處理,也沒啥作用

proxy_set_header X-Real-IP $remote_addr;

proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

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

proxy_set_header SSL_CERT $ssl_client_cert;

}

}

}

本文標簽: 后端  設置為  雙向