首页 > 解决方案 > 使用 PHP 在 Apache 中运行 Node.js

问题描述

我有一个PHP应用程序在我自己的服务器上运行(不是 localhost,而是一个可通过 Internet 访问的真实服务器),我想将Node.js服务器添加到它。我看到这篇文章说Reverse Proxy。在文章的最后,它提到这种特殊的方法有性能成本,因此只适用于特定的情况。

值得注意的是,这种方法适用于用户数量有限的特定角色。但是,如果您想获得性能可扩展性,则需要分别运行 apache 和 node.js 并使用 nginx 之类的东西来执行反向代理。

现在我想知道这是如何以及为什么会这样,以及我是否应该放弃这种方法,因为我有很多用户使用我的服务。如果有人有比这种方法更好的建议,请赐教!先感谢您。

标签: phpnode.jsapacheserverreverse-proxy

解决方案


I use such an approach myself and as far as you don't need a low latency I don't see the necessity of this.
The best solution for getting around the Proxy would be using a different port.
Due to Apache managing the domain resolving.
It might also be worth noting that apache does compression and SSL which is something you would have to worry about your NPM running on a possibly different port than 443.


推荐阅读