Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.2k views
in Technique[技术] by (71.8m points)

apache - How to setup a reverse proxy on several ports (tcp & udp)

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 Port: 3389

MSSQL

TCP Port: 1143

TEAMSPEAK

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

LOGIN SERVER

TCP Port: 15001 TCP Port: 15100

GAMESERVER

TCP Port: 15221

FTP

21

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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

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

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...