如何在多个端口上设置反向代理 (tcp & udp) [英] How to setup a reverse proxy on several ports (tcp & udp)

查看:93
本文介绍了如何在多个端口上设置反向代理 (tcp & udp)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经为该网站设置了一个反向代理,现在我想用下面所述的端口代理我的游戏服务器,但我真的找不到任何地方如何执行此操作.有没有人有想法?如果可能,我想在 apache 上执行此操作.我在 ubuntu 上运行.

I have setup a reverse proxy for the website, and now I want to proxy my game server aswell with the ports stated below, but I realy can't find anywhere how to perform this. Does anyone have an idea? I would like to do this if possible on apache. Am running on ubuntu.

RDP

TCP 端口:3389

TCP Port: 3389

MSSQL

TCP 端口:1143

TCP Port: 1143

团队演讲

UDP 端口:9987TCP 端口:9987TCP 端口:10011TCP 端口:30033

UDP Port: 9987 TCP Port: 9987 TCP Port: 10011 TCP Port: 30033

登录服务器

TCP 端口:15001TCP 端口:15100

TCP Port: 15001 TCP Port: 15100

游戏服务器

TCP 端口:15221

TCP Port: 15221

FTP

21

推荐答案

Apache 不是代理 TCP 连接的理想工具.Nginx plus 可以做到但它不是免费的.

Apache is not an ideal tool for proxying TCP connections. Nginx plus can do it but it's not free.

您想要的是像 squid 这样的代理服务器,它有很好的文档记录.

What you want is a proxy server like squid which is very well documented.

您也可以在没有额外软件的情况下执行此操作,只需按照说明使用 IP 表 此处.

You can also do this without extra software, just with IP tables as explained here.

iptables -t nat -A PREROUTING -p tcp --dport 1111 -j DNAT --to-destination ip:port
iptables -t nat -A PREROUTING -p tcp --dport 1112 -j DNAT --to-destination ip:port
iptables -t nat -A PREROUTING -p tcp --dport 1113 -j DNAT --to-destination ip:port
iptables -t nat -A POSTROUTING -j MASQUERADE

这篇关于如何在多个端口上设置反向代理 (tcp & udp)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆