Node.js-如何从URL中删除端口? [英] Node.js - How can I remove the port from the url?

查看:271
本文介绍了Node.js-如何从URL中删除端口?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用node.js和socket.io.

I use the node.js and socket.io.

我的应用程序在端口3000上运行.该应用程序从以下网址启动: mydomain.com:3000/

My application runs on the port 3000. The application starts from from the url: mydomain.com:3000/

我想从 mydomain.com 运行应用程序-我想从网址中删除端口.

I want to run the application from mydomain.com - I want to remove the port from the url.

我在哪里以及如何设置此设置?

Where and how can I set this setting?

推荐答案

找到您的

Find your server.listen call and change the port from 3000 to 80. Don't forget that you have to run the program with the CAP_NET_BIND_SERVICE capability (see capabilities(7) for details) in order to bind to ports less than 1024 on Linux systems. root privilege will contain this, and other, privileges.

这篇关于Node.js-如何从URL中删除端口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆