简体   繁体   English

与apache Web服务器和Node.js REST服务器共享HTTP端口80

[英]Share HTTP port 80 with apache webserver and Node.js REST server

In the past, I built a REST API server on WAMP (Windows, Apache server, MySQL, PHP). 过去,我在WAMP(Windows,Apache服务器,MySQL,PHP)上构建了REST API服务器。 Recently, I built a REST API server with node.js restify. 最近,我用node.js restify构建了一个REST API服务器。 However, I cannot use port 80 for the node.js REST server because there is a conflict with the Apache server. 但是,我不能将80端口用于node.js REST服务器,因为与Apache服务器存在冲突。 How can I share port 80 with apache webserver and Node.js REST server? 如何与Apache Web服务器和Node.js REST服务器共享端口80?

There was no such problem with the WAMP version. WAMP版本没有这样的问题。 Both REST server and webserver were using HTTP port 80. REST服务器和Web服务器都使用HTTP端口80。

No port can be shared with 2 listeners. 不能与2个侦听器共享端口。 only one application can listen on a port, either apache or node process. 只有一个应用程序可以侦听端口(apache或节点进程)。

When you say you used it in the past, i am assuming you made 2 web APIs/Apps both hosted from the same apache server. 当您说过去使用它时,我假设您制作了两个Web API /应用程序,它们都从同一apache服务器托管。 is that correct? 那是对的吗? If that is correct, then that clarifies earlier you had not two but one web server apache running on port 80, isn't it? 如果这是正确的,那么这可以更早地澄清您在端口80上运行的不是两个,而是一个Web服务器apache,不是吗?

I also had the same problem , My two applications were running on the same port, so moved one the application to 8080 port , it started working fine . 我也遇到了同样的问题,我的两个应用程序都在同一端口上运行,因此将其中一个应用程序移至8080端口,它开始正常工作。 You can go for also by securing one of them , then it will be at different domains according the browser.Specify the IP address , don do it for "localhost" 您也可以通过保护其中之一来进行购买,然后根据浏览器将其放置在不同的域中。指定IP地址,不要将其用于“ localhost”

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

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