Nginx Reverse UDP & TCP Proxy
Reference:
Nginx Reverse Proxy:
Maybe you have Nginx as a front-end server on your cloud VPS, and you prefer to run back-end services on your own hardware, tunneled over a VPN. The following can be added to the top-level nginx configuration (probably /etc/nginx/nginx.conf
) to enable UDP and TCP reverse proxying to your back-end service:
stream {
server {
listen 12345;
#TCP traffic will be forwarded
proxy_pass <IP_or_domain>:12345;
}
server {
listen 4444;
#TCP traffic will be forwarded
proxy_pass <IP_or_domain>:4444;
}
server {
listen 4444 udp;
#UDP traffic will be forwarded
proxy_pass <IP_or_domain>:4444;
}
}
Be sure the stream { ... }
block is outside of the top-level http { ... }
block.
No Comments