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
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章