gpt4 book ai didi

node.js - 在 Apache 代理后面运行多个 Node.js 服务器

转载 作者:搜寻专家 更新时间:2023-11-01 00:01:04 24 4
gpt4 key购买 nike

我在不同的端口上运行多个 Node.js 服务器,并在我的客户端中使用 Websocket 来连接这些不同的服务器。客户端在没有 websocket 的情况下也使用给定的服务器端口进行 Ajax 调用,并且一切正常。

现在的问题是,因为我使用非标准端口来运行多个 node.js 服务器,所以在从客户端进行调用时,它们被防火墙阻止了。所以我想在两者之间引入一个 Apache 代理,并将所有重新测试发送到标准端口 80 上的 apache,然后在后台与多个 Node.js 服务器进行交互。我试图在附件中解释现有的和想要的 senario。

需要您的帮助以进行适当的 Apache 代理配置以使其正常工作。 enter image description here

最佳答案

您可以尝试使用虚拟主机和代理传递,例如

    <VirtualHost *:80>
ProxyRequests off
<Proxy *>
Order deny,allow
#Require all granted
Allow from all
</Proxy>

ProxyPass /A?query http://example.com/app
ProxyPassReverse /A?query http://example.com/app

ProxyPass /B?query http://localhost:8081/$1
ProxyPassReverse/B?query http://localhost:8081/$1

ProxyPassMatch "^(/.{1,})$" http://localhost:8082/$1
ProxyPassReverse "^(/.{1,})$" http://localhost:8082/$1

</VirtualHost>

关于node.js - 在 Apache 代理后面运行多个 Node.js 服务器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32410061/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com