简体   繁体   English

现有域上的节点 js

[英]Node js on existing domain

i wanna use node js on my webpage, which is hosted by a company.我想在我的网页上使用节点 js,该网页由一家公司托管。 I saw that you can run a local server on node js, but does anyone know how i can link it to my existing domain example.com .我看到您可以在节点 js 上运行本地服务器,但有谁知道我如何将它链接到我现有的域example.com

As mentioned I saw that you can use express for this, but i dont know my port neither how my server reacts to my js code.如前所述,我看到您可以为此使用express ,但我不知道我的端口也不知道我的服务器如何对我的 js 代码做出反应。

any recommendations?有什么建议吗?

To be able to access your locally developed node project from your domain name from any computer connected to the internet you will need to do something like the following:为了能够从连接到 Internet 的任何计算机上从您的域名访问您本地开发的节点项目,您需要执行以下操作:

Point your domain's DNS records to your server将您域的 DNS 记录指向您的服务器

Log into your domain name provider and find the DNS settings section, then paste in your servers IP address.登录您的域名提供商并找到 DNS 设置部分,然后粘贴您的服务器 IP 地址。 Once this is done, visiting your domain name in the browser will connect the domain to your server which you control.完成此操作后,在浏览器中访问您的域名会将域连接到您控制的服务器。 Under the hood the browser can now successfully ask the domain name server (keeps records of domains and associated IP addresses) for the IP address to query which corresponds to your domain name.在后台,浏览器现在可以成功地向域名服务器(保留域记录和相关的 IP 地址)询问 IP 地址以查询与您的域名相对应的地址。 But thats not quite enough yet!但这还不够!

Install a server application on your server在您的服务器上安装服务器应用程序

A server is just a normal computer with server software installed which enables incoming requests to receive a response in anyway you define in the configuration of the server software.服务器只是安装了服务器软件的普通计算机,它使传入的请求能够以您在服务器软件配置中定义的任何方式接收响应。 nginx, apache and express are all types of server software. nginx, apache 和 express 是所有类型的服务器软件。 At this point you need to see whether the server you are renting supports nodejs as a server, if not you should look elsewhere for a provider that does.此时您需要查看您租用的服务器是否支持 nodejs 作为服务器,如果不支持,您应该在其他地方寻找支持的提供商。 (not hard to find) (不难找)

Install software dependencies to get your express server up and running.安装软件依赖项以启动并运行您的 express 服务器。

EG: node, npm, express EG:节点,npm,快递

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

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