简体   繁体   English

使用Apache Tomcat的socket.io

[英]socket.io with Apache Tomcat

I am using node.js server and implemented socket.io. 我正在使用node.js服务器并实现了socket.io。

It works fine, but for some reason, I have to use Apache Tomcat, running on port 8080, and the node server running on 8081. 它工作正常,但是由于某些原因,我必须使用运行在端口8080上的Apache Tomcat和运行在8081上的节点服务器。

If I run the application via :8081 (serving pages through node.js), socket.io (socket.io is listening to 8081 port) is working, but when I serve through Apache Tomcat running application via :8080/Demo_Pro/index.html , socket.io is not working. 如果我通过:8081 (通过node.js服务页面)运行该应用程序,则socket.io(socket.io正在监听8081端口)正在运行,但是当我通过:8080 / Demo_Pro / index通过运行该应用程序的Apache Tomcat服务时。 html ,socket.io无法正常工作。

Can anybody explain how to run both Apache Tomcat and node.js at the same time. 谁能解释一下如何同时运行Apache Tomcat和node.js。

You should look on google on how to host node.js and apache at the same time. 您应该在google上了解如何同时托管node.js和apache。 You'll find that you'll have to use mod_proxy to proxy requests through apache. 您会发现必须使用mod_proxy通过apache代理请求。 (node.js needs to be on another port). (node.js需要在另一个端口上)。 Look at this link: how to put nodejs and apache in the same port 80 . 看一下此链接: 如何将nodejs和apache放在同一端口80中 It'll give you an idea on how to do it. 它会为您提供有关操作方法的想法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM