CKBox 本地部署 SSL 通信
您可以使用安全连接与 CKBox 本地部署进行通信。为此,您需要使用 SSL 证书设置负载均衡器,例如 `NGINX` 或 `HAProxy`。
您可以在下面找到 `HAProxy` 和 `NGINX` 配置示例。
# `HAProxy` 示例
这是一个基本的 `HAProxy` 配置
global
daemon
maxconn 256
tune.ssl.default-dh-param 2048
defaults
mode http
timeout connect 5000ms
timeout client 50000ms
timeout server 50000ms
frontend http-in
bind *:80
bind *:443 ssl crt /etc/ssl/your_certificate.pem
http-request set-header X-Forwarded-Proto https if { ssl_fc }
http-request set-header X-Forwarded-Proto http if !{ ssl_fc }
redirect scheme https if !{ ssl_fc }
default_backend servers
backend servers
server server1 127.0.0.1:8080 maxconn 32
# `NGINX` 示例
这是一个基本的 `NGINX` 配置
events {
worker_connections 1024;
}
http {
server {
server_name your.domain.name;
listen 443;
ssl on;
ssl_certificate /etc/ssl/your_cert.crt;
ssl_certificate_key /etc/ssl/your_cert_key.key;
location / {
proxy_pass http://127.0.0.1:8080;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_http_version 1.1;
}
}
}