Nginx端口映射TCP |
添加到以下: 1. /etc/nginx/nginx.conf 添加的内容为下述: 1. stream { 2. upstream tcpLink { 3. hash $remote_addr consistent; 4. server 127.0.0.1:31905 weight=5 max_fails=3 fail_timeout=30s; 5. } 6. server { 7. listen 4008; 8. proxy_connect_timeout 1s; 9. proxy_timeout 3s; 10. proxy_pass tcpLink; 11. } 12. } 监听4008,映射到为127.0.0.1:31905,名字是tcpLink。 |