2012-01-27 51 views
0

我有以下基础设施,并希望使用运行Openfire服务器的内部xmpp服务器(服务器2)提供在线网络聊天(在服务器1上)。HTTP绑定代理/网关

湾< ---->服务器1 < ---->服务器2

服务器1只能达到服务器2通过HTTP代理。所以我需要在服务器1上获得一个HTTP绑定或其他东西的可能性,它提供了像JWChat或Co.这样的网络聊天的绑定。我认为简单的重定向到服务器2上的HTTP绑定会很好,但是我不知道如何。

也许有另一种可能性,谢谢任何意见。

编辑:
nginx的配置,现在是这样的:

server { 
    listen  8000; 
    server_name server1 localhost; 

    location ~ ^/http-bind { 
     proxy_pass http://server2:8085; 
    } 

    location/{ 
     proxy_pass http://proxy:3128; 
    } 
} 

但下面的命令不能正常工作:

-bash-4.1# wget http://localhost:8000 
--2012-02-06 10:57:14-- http://localhost:8000/ 
Resolving localhost... 127.0.0.1 
Connecting to localhost|127.0.0.1|:8000... connected. 
HTTP request sent, awaiting response... 400 Bad Request 
2012-02-06 10:57:14 ERROR 400: Bad Request. 

-bash-4.1# wget http://localhost:8000/http-bind 
--2012-02-06 10:57:21-- http://localhost:8000/http-bind 
Resolving localhost... 127.0.0.1 
Connecting to localhost|127.0.0.1|:8000... connected. 
HTTP request sent, awaiting response... 502 Bad Gateway 
2012-02-06 10:57:21 ERROR 502: Bad Gateway. 

有什么不对?

回答

0

通常服务器1将运行:

  1. 代理
  2. 运行你的聊天应用Web服务器。

让我们假设nginx的上的端口80上运行的代理,并且您在端口8080上运行的Web服务器的选择也假定您的Web客户端将绑定到/http-bind。然后,您的nginx配置将包含:

server { 
     listen  80; 
     server_name server1; 

     location ~ ^/http-bind { 
      proxy_pass http://server2:5280; 
     } 

     location/{ 
      proxy_pass http://localhost:8080/; 
     } 

    } 

相应地适应其他一些代理。

+0

我可以配置nginx使用代理来访问服务器2吗? – CSchulz 2012-02-04 13:49:13

+0

当然,nginx会代理你的其他代理。不是什么意思,但是你可以 – ggozad 2012-02-04 15:07:13

+0

但是nginx必须使用代理来访问服务器2. – CSchulz 2012-02-04 16:40:27