如何把的NodeJS和apache在相同的端口80 [英] how to put nodejs and apache in the same port 80

查看:378
本文介绍了如何把的NodeJS和apache在相同的端口80的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经把在的NodeJS 80端口,但是Apache已经在使用它。我怎样才能把两者(和的NodeJS Apache)的同一端口80?我需要它,因为在我的大学被封锁,除了端口80(这是和的NodeJS socket.io(WebSockets的一个实时的应用程序),并在另一侧的PHP应用程序)的所有端口。
非常感谢

I have to put nodejs in port 80, but apache is already using it. How can I put both (nodejs and apache) on the same port 80? I need it because in my university all the ports are blocked except for PORT 80. (This is a realtime application with nodejs and socket.io (websockets) and in the other side a php application). Thanks a lot

推荐答案

我个人这一轮从@liammclennan做的其他方式。 有人建议通过Apache的代理失败的一些节点的性能和可扩展性的优势(不要有经验的自己是我的服务器没有得到多少流量,而是来自@ liammclennan的链接:是通过Apache进来的每个请求都将导致一个Apache线程等待/块,直到响应从您的Node.js返回过程。的,这显然不符合节点的架构以及网)

I've personally done this the other way round from @liammclennan. Some suggest that proxying through Apache defeats some of the performance and scalability advantages of Node (don't have experience myself as my server doesn't get that much traffic, but from @liammclennan's link: "Every request that comes in through Apache will cause an Apache thread to wait/block until the response is returned from your Node.js process.", which obviously doesn't mesh well with Node's architecture.)

我用节点HTTP代理来建立一个节点代理服务器大致为在第一个链接描述(我的节点代理在端口80上; Apache和我的其他节点服务不)。似乎运作良好,到目前为止,虽然我有过,我已经通过检查代理解决偶尔的稳定性问题仍然使用cron作业(修改运行:似乎这些天很多更稳定)。代理的pretty重量轻,占用30MB左右的内存。

I used node-http-proxy to set up a Node proxy server roughly as described in the first link (my Node proxy runs on port 80; Apache and my other Node services don't). Seems to be working well so far, though I have had occasional stability problems that I've 'solved' through checking the proxy's still running with a cron job (edit: it seems a lot more stable these days). The proxy's pretty lightweight, taking up about 30MB memory.

这篇关于如何把的NodeJS和apache在相同的端口80的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆