有臺服務器爲windows,現在要通過遠程管理,但該服務器是在內網,只能通過前置機跳轉,而前置機爲linux,需要用到tcp代理,該服務器已安裝了nginx-1.2.9,打算使用nginx的tcp代理模塊來做,以下是安裝配置過程
在root目錄下載解壓軟件,得到nginx_tcp_proxy_module-master目錄
wget https://github.com/yaoweibin/nginx_tcp_proxy_module/archive/master.zip
unzip master.zip
進入nginx原安裝路徑 ,將nginx進程停止,安裝和編譯模塊
cd /root/nginx-1.2.9
killall nginx
patch -p1 </root/nginx_tcp_proxy_module-master
./configure --add-module=/root/nginx_tcp_proxy_module
make
make install
/usr/local/nginx/sbin/nginx -V
安裝完成後,配置tcp代理,在nginx.conf文件最後添加如下內容,需要注意的是http和tcp不能使用相同端口
tcp {
upstream cluster {
# simple round-robin
server 192.168.1.23:3389;
check interval=3000 rise=2 fall=5 timeout=1000;
#check interval=3000 rise=2 fall=5 timeout=1000 type=ssl_hello;
#check interval=3000 rise=2 fall=5 timeout=1000 type=http;
#check_http_send "GET / HTTP/1.0\r\n\r\n";
#check_http_expect_alive http_2xx http_3xx;
}
server {
listen 3389;
proxy_pass cluster;
access_log logs/3389_access.log;
}
}
添加完成後,測試配置文件,運行nginx
/usr/local/nginx/sbin/nginx -t
/usr/local/nginx/sbin/nginx
即可訪問遠程桌面
參觀文章https://github.com/yaoweibin/nginx_tcp_proxy_module