是否可以将端口 80 用于 HTTP 和 Web 套接字流量? [英] Is it possible to use port 80 for both HTTP and web socket traffic?
问题描述
- 我正在构建一个使用网络套接字(技术上是 Flash 套接字)的网站,以提供实时通信.
- 我希望能够为公司/学术防火墙背后的人提供支持,这些防火墙会阻止除端口 80 之外的所有内容
- 我希望能够在一台机器上运行该网站
以前,我一直在使用 Apache 进行 HTTP 服务,并结合一些 python 在高编号套接字上侦听 websocket 内容,但这显然在这里不起作用.
Previously, I've been using Apache for HTTP serving combined with some python listening on a high-numbered socket for the websocket stuff, but that obviously won't work here.
我总是可以将 websocket 内容移动到单独的服务器,但我想避免为第二个 VPS 付费(并且必须通过网络而不是本地与数据库交谈).有没有好的方法可以做到这一点(nodejs,nginx,..?),还是不值得头疼?
I can always move the websocket stuff to a separate server, but I'd like to avoid paying for a second VPS (and have to talk to the database over the network instead of locally). Is there a good way to do this (nodejs, nginx, ..?), or is it not worth the headache?
推荐答案
- http://code.google.com/p/pywebsocket/立>
- 哪些流行的网络服务器支持 HTML5 WebSocket?
- https://serverfault.com/questions/201825/how-would-i-configure-a-websocket-server-to-run-alongside-a-webserver
另一种可能性是在 apache 中使用 mod_proxy 将请求重定向到 websocket 服务器.
Another possibility is to use mod_proxy in apache to redirect the requests to a websocket server.
这篇关于是否可以将端口 80 用于 HTTP 和 Web 套接字流量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!