snake22
2023-04-02 10:01:45 +08:00
nginx 开启 stream_ssl_module 模块采用四层协议配置正向代理
# 四层代理
stream {
log_format basic '$remote_addr [$time_local] '
'$protocol $status $bytes_sent $bytes_received '
'$session_time';
log_format test '--$remote_addr [$time_local] '
'--$ssl_preread_server_name $server_port --serveraddr:$server_addr --hostname:$hostname'
'--$ssl_server_name $ssl_server_name';
access_log /home/nginx/nginx-server/logs/stream-access.log basic;
access_log /home/nginx/nginx-server/logs/stream-test.log test;
# 此处四 dns 服务器 ip
resolver 114.114.114.114;
server{
listen 443;
ssl_preread on;
proxy_connect_timeout 60;
proxy_pass $ssl_preread_server_name:$server_port;
}
}
客户端配置 host 指向 该 nginx 服务器即可