我有我的机器上运行的Apache,我必须运行我的应用程序,而无需添加端口号。如何在默认端口上设置节点js应用程序?
当我用下面从http://localhost:2121访问它的工作原理:(后面没有端口号)
var http = require('http');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('hello');
}).listen(2121);
console.log('Server running');
我将它设置为使用http://localhost如何
的可能的复制[Node.js的 - 我如何从URL删除端口?] (http://stackoverflow.com/questions/9526500/node-js-how-can-i-remove-the-port-from-the-url) –
你只是'.listen(80)' - 但是,如果apache在端口80上运行已经无法工作,因为您不能让两台服务器在同一个端口上侦听。 – MrWillihog
可能是时候了解更多关于** Apache mod-proxy **的附加组件,以及如何将流量从80重新定向到:2121 –