nginx_tcp_proxy_module icon indicating copy to clipboard operation
nginx_tcp_proxy_module copied to clipboard

question for tcp_proxy_module...

Open fankeke opened this issue 10 years ago • 1 comments

hello I'm a nginx new learner,recently I read you tcp_proxy module for ngx,bu I have some questions.

ONE:what's the difference between the ngx_http_proxy_module and this module(tcp_proxy)? I konw it would be a stupid question to ask ,bu after searching on google ,I just can't figure it out . here are some guess of mine: http_proxy_module was targeting to forward the http stream, which is based on tcp stream,so it works on the application layer. and I configure my nginx.conf like this: .... server { listen 80; server_name localhost; location / { proxy_pass http://www.google.com; } } so ,when I search in my brower like:localhost,it would redirect to google. and I konw how it works. because I can see what happend , so I can understood the source code of http_prory_module.

as for the tcp_proxy,it was totally new for me,after search many times on google,I'm really depressed. first, I can't tell what a tcp proxy is ,and what it for?, redirect to tcp stream?(no offence) so please would you give me some guide or some material to read? and then, I install your tcp_proxy successfully, but I don't know how to check what's would happen. after configuring nginx.conf file like this : tcp { upstream cluster1 { server localhost:2221; server localhost:2222; server localhost:2223; server localhost:2224; check interval=3000 rise=2 fall=5 timeout=1000; } server { listen 8888; proxy_pass cluster1; }

upstream cluster2 { server localhost:2225; server localhost:2226; server localhost:2227; server localhost:2228; server localhost:2229; check interval=3000 rise=2 fall=5 timeout=1000; } server { listen 8888; proxy_pass cluster2; } upstream cluster3 { server localhost:225; server localhost:226; server localhost:227; server localhost:228; server localhost:229; check interval=3000 rise=2 fall=5 timeout=1000; } server { listen 8888; proxy_pass cluster3; }

} then visite localhost/status : screenshot-91

so ,what 's the meaning of this configure.(I follow your configure and rewrite like this ,but just can't understood what the meaning is ).

TWO: I 'm so appreciate your ability ,wish I could like you can write so elegent code for nginx.. what books or something else do you think I could read to improve my ability on developing on nginx.....

many thanks..

fankeke avatar Jan 22 '15 02:01 fankeke

This module is proxy the tcp layer protocol. Http proxy is proxy the http protocol. TCP is layer 4. HTTP is layer 7. TCP proxy module also can proxy http protocol. But it lacks many useful features of HTTP protocol.

Read the source code is the only way to improve developing Nginx.

Thanks.

2015-01-22 10:43 GMT+08:00 fankeke [email protected]:

hello I'm a nginx new learner,recently I read you tcp_proxy module for ngx,bu I have some questions.

ONE:what's the difference between the ngx_http_proxy_module and this module(tcp_proxy)? I konw it would be a stupid question to ask ,bu after searching on google ,I just can't figure it out . here are some guess of mine: http_proxy_module was targeting to forward the http stream, which is based on tcp stream,so it works on the application layer. and I configure my nginx.conf like this: .... server { listen 80; server_name localhost; location / { proxy_pass http://www.google.com; } } so ,when I search in my brower like:localhost,it would redirect to google. and I konw how it works. because I can see what happend , so I can understood the source code of http_prory_module.

as for the tcp_proxy,it was totally new for me,after search many times on google,I'm really depressed. first, I can't tell what a tcp proxy is ,and what it for?, redirect to tcp stream?(no offence) so please would you give me some guide or some material to read? and then, I install your tcp_proxy successfully, but I don't know how to check what's would happen. after configuring nginx.conf file like this : tcp { upstream cluster1 { server localhost:2221; server localhost:2222; server localhost:2223; server localhost:2224; check interval=3000 rise=2 fall=5 timeout=1000; } server { listen 8888; proxy_pass cluster1; }

upstream cluster2 { server localhost:2225; server localhost:2226; server localhost:2227; server localhost:2228; server localhost:2229; check interval=3000 rise=2 fall=5 timeout=1000; } server { listen 8888; proxy_pass cluster2; } upstream cluster3 { server localhost:225; server localhost:226; server localhost:227; server localhost:228; server localhost:229; check interval=3000 rise=2 fall=5 timeout=1000; } server { listen 8888; proxy_pass cluster3; }

} so ,what 's the meaning of this configure.(I follow your configure and rewrite like this ,but just can't understood what the meaning is ).

TWO: I 'm so appreciate your ability ,wish I could like you can write so elegent code for nginx.. what books or something else do you think I could read to improve my ability on developing on nginx.....

many thanks..

— Reply to this email directly or view it on GitHub https://github.com/yaoweibin/nginx_tcp_proxy_module/issues/107.

yaoweibin avatar Jan 22 '15 13:01 yaoweibin