Nginx进行TCP代理配置

普通TCP

stream {
         server {
                listen 16380; #要监听的端口
                proxy_pass 192.168.0.195:6379;  #要转发的地址
        }
}

在这里插入图片描述

SSL验证的TCP

stream {
         server {
                listen 16380 ssl; #要监听的端口
                proxy_pass 192.168.0.195:6379;  #要转发的地址
                ssl_certificate       /data/crt/server.crt;
                ssl_certificate_key   /data/crt/server_no_passwd.key;
        }
}

在这里插入图片描述
修改保存后, 执行 nginx -s reload 即可


可能遇到的问题:

在这里插入图片描述
提示该问题是因为缺少 --with-stream_ssl_module 模块
啥也不说了, 进入nginx根目录, 直接安装常用模块

./configure --user=nginx --group=nginx --with-http_ssl_module --with-http_realip_module --with-http_addition_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_stub_status_module --with-http_auth_request_module --with-mail --with-mail_ssl_module --with-file-aio --with-http_v2_module --with-stream --with-stream_ssl_module

make && make install
发布了10 篇原创文章 · 获赞 3 · 访问量 285

猜你喜欢

转载自blog.csdn.net/AWen_Jack/article/details/104059781