nginx_tcp_proxy_module
nginx_tcp_proxy_module copied to clipboard
Multiple proxies with name based virtual hosts?
I'm attempting to get one nginx process to proxy for two separate webapps differentiated by hostname. Here's my nginx.conf:
worker_processes 1;
events {
worker_connections 1024;
}
tcp {
upstream app1 {
server 127.0.0.1:8000;
}
upstream app2 {
server 127.0.0.1:9000;
}
server {
listen 80;
server_name app1;
proxy_pass app1;
access_log /sitelogs/nginx/app1-access.log;
}
server {
listen 80;
server_name app2;
proxy_pass app2;
access_log /sitelogs/nginx/app2-access.log;
}
}
but it doesn't seem to be working. Any requests to the box at either hostname are all getting proxied to app1.
Is what I'm trying possible, or do I need to find another solution? What am I missing?
Thanks!
yes, use the websocket proxy module, see the readme for dedail.
在 2012 年 10 2 日,1:02 上午,"Kent Cowgill" [email protected]编写:
I'm attempting to get one nginx process to proxy for two separate webapps differentiated by hostname. Here's my nginx.conf:
worker_processes 1;
events { worker_connections 1024;} tcp { upstream app1 { server 127.0.0.1:8000; } upstream app2 { server 127.0.0.1:9000; } server { listen 80; server_name app1; proxy_pass app1; access_log /sitelogs/nginx/app1-access.log; } server { listen 80; server_name app2; proxy_pass app2; access_log /sitelogs/nginx/app2-access.log; }}
but it doesn't seem to be working. Any requests to the box at either hostname are all getting proxied to app1.
Is what I'm trying possible, or do I need to find another solution? What am I missing?
Thanks!
— Reply to this email directly or view it on GitHubhttps://github.com/yaoweibin/nginx_tcp_proxy_module/issues/55.