目的:
Nginx
配置 SSL
,透传到 后端。 根据不同的域名转发到不同的后端。
配置示例:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
| user root; worker_processes auto; events { worker_connections 1024; } stream { log_format basic '$remote_addr [$time_local] ' '$protocol $status $bytes_sent $bytes_received ' '$session_time "$upstream_addr" ' '"$ssl_preread_server_name" "$name"'; access_log /var/log/nginx/stream_access.log basic; map $ssl_server_name $name { default app_default_backend; app.ownding.com.cn app1_backend; www.ownding.com.cn app2_backend; } upstream app1_backend { server 192.168.0.117:30080 weight=5 max_fails=1 fail_timeout=10s; } upstream app2_backend { server 192.168.0.117:30081 weight=5 max_fails=1 fail_timeout=10s; } upstream app_default_backend { server 192.168.0.117:30081; } server { listen 31180 ssl; ssl_certificate /home/cert/scs1687747992522__.ownding.com.cn_server.crt; ssl_certificate_key /home/cert/scs1687747992522__.ownding.com.cn_server.key; proxy_pass $name; } }
|