如何将 nodejs 和 apache 放在同一个端口 80 [英] how to put nodejs and apache in the same port 80

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

问题描述

我必须将 nodejs 放在端口 80,但 apache 已经在使用它.如何将(nodejs 和 apache)都放在同一个端口 80 上?我需要它,因为在我的大学中,除了 PORT 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 代理会破坏 Node 的一些性能和可扩展性优势(不要我自己没有经验,因为我的服务器没有获得那么多流量,但是来自 @liammclennan 的链接:通过 Apache 传入的每个请求都会导致 Apache 线程等待/阻塞,直到响应从您的 Node.js 返回.js 进程.",这显然不符合 Node 的架构.)

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.)

我用node-http-proxy粗略搭建了一个Node代理服务器如第一个链接中所述(我的 Node 代理在端口 80 上运行;Apache 和我的其他 Node 服务没有).到目前为止似乎运行良好,但我偶尔会遇到稳定性问题,我通过检查代理是否仍在运行 cron 作业来解决"(这些天似乎更稳定了).代理非常轻巧,占用大约 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天全站免登陆