There are a few standard ways of proxying inbound general network traffic ("reverse proxying").
If the inbound traffic is only HTTP(S), then a web server can forward it. See e.g. ProxyPass
in Apache.
Arbitrary inbound TCP traffic can be proxied with SOCKS. A SOCKS-aware client wraps its request in a SOCKS request, and sends it to a SOCKS server, which interprets and forwards the request. This is often done with ssh, which offers the DynamicForward
option to set up a SOCKS proxy. It opens a port that listens on the client host, forwards SOCKS traffic over the encrypted connection, and interprets and routes it on the server. Many network clients can be told to use a SOCKS proxy.
Another common way is to tunnel traffic over SSL. stunnel for example will do this. On the client it listens on a port, wraps the traffic within SSL, and sends it to an server. On the server, stunnel unwraps the SSL and forwards the traffic to a configured service.
You can send different types of traffic to the same port, often 443, by using a port multiplexer on the other end to figure out what type of traffic it is and route it to the right service. sslh and sshttp are two that handle the common case of multiplexing HTTP and SSH on one port - say wrapped in SSL and sent to port 443. Finally TCPMUX is a protocol that was developed for port multiplexing. xinetd for example can interpret it, but it isn't implemented in any clients that I know of. (You'd want to wrap it in SSL.)