Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Multiple proxies with name based virtual hosts? #55

Open
kcowgill opened this Issue Oct 1, 2012 · 1 comment

Comments

Projects
None yet
2 participants

kcowgill commented Oct 1, 2012

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!

Owner

yaoweibin commented Oct 2, 2012

yes, use the websocket proxy module, see the readme for dedail.

在 2012 年 10 2 日,1:02 上午,"Kent Cowgill" notifications@github.com编写:

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment