#user nobody;
worker_processes 1;
daemon off;
master_process off;
error_log logs/error.log;
pid logs/nginx.pid;
load_module objs/ngx_http_upstream_check_module.so;
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;
keepalive_timeout 65;
upstream backend {
check type=https interval=3000 rise=2 fall=5 timeout=1000 port=443;
check_http_send "GET / HTTP/1.1\r\nHost: www.test.com\r\n\r\n";
check_http_expect_alive http_2xx http_3xx;
check_ssl_server_name www.test.com;
server 192.168.0.1:443;
}
server {
listen 9080;
server_name localhost;
# 开启本模块的状态查询接口
location /status {
check_status html;
}
location / {
proxy_pass http://backend;
}
#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;
}
}
}
以上配置文件中的upstream块中定义了一个https的健康检测类型, check_http_send复用了http的定义,而check_ssl_server_name是新增的指令,用来配置ssl握手设置sni扩展主机host信息。