在Windows中配置Nginx TCP代理服务

Nginx不仅用作Web代理服务器(支持http和https协议), 它也可以用作常规的TCP代理服务器,支持任何TCP端口, 如TCP 3306, 3690, 3389, 22 等等.

它可以实现以下功能. 客户端无法直接访问源服务器A和源服务器B, 但是服务器C可以. 我们在服务器C上配置代理服务, 因此客户端可以通过服务器C上的代理服务访问服务器A和服务器B.

在这段话中, 我将简要介绍Nginx TCP代理服务的配置.

NGINX版本

nginx / 1.13.3

符合参数


启用TLS SNI支持
配置参数: –with-cc = cl \
–builddir = objs.msvc8 \
–带调试 \
–前缀= \
–conf-path = conf / nginx.conf \
–pid-path = logs / nginx.pid \
–http-log-path = logs / access.log \
–error-log-path =日志/error.log \
–sbin-path = nginx.exe \
–http-client-body-temp-path = temp / client_body_temp \
–http-proxy-temp-path = temp / proxy_temp \
–http-fastcgi-temp-path = temp / fastcgi_temp \
–http-scgi-temp-path = temp / scgi_temp \
–http-uwsgi-temp-path = temp / uwsgi_temp \
–with-cc-opt = -DFD_SETSIZE = 1024 \
–with-pcre = objs.msvc8 / lib / pcre-8.40 \
–使用-zlib = objs.msvc8 / lib / zlib-1.2.11 \
–with-select_module \
–与-http_v2_module \
–与-http_realip_module \
–与-http_addition_module \
–与-http_sub_module \
–与-http_dav_module \
–with-http_stub_status_module \
–与-http_flv_module \
–与-http_mp4_module \
–与-http_gunzip_module \
–与-http_gzip_static_module \
–与-http_auth_request_module \
–与-http_random_index_module \
–与-http_secure_link_module \
–与-http_slice_module \
–带邮件 \
–流式 \
–with-openssl = objs.msvc8 / lib / openssl-1.0.2l \
–with-openssl-opt =否-asm \
–与-http_ssl_module \
–with-mail_ssl_module \
–with-stream_ssl_module

nginx.conf的参数


用户无人;
worker_processes 2;
大事记 {
worker_connections 1024;
}
流 {
包括vhost / *。conf;
上游商务 {
服务器IP_A:PORT_A;
}
上游莫奈 {
服务器IP_B:PORT_B;
}
}

HOST A的参数


服务器 {
听PORT_C;
proxy_pass IP_A;
}

HOST B的参数


服务器 {
听PORT_D;
proxy_pass IP_B;
}

发表评论