简体   繁体   中英

Node js on existing domain

i wanna use node js on my webpage, which is hosted by a company. 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 .

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.

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:

Point your domain's DNS records to your server

Log into your domain name provider and find the DNS settings section, then paste in your servers IP address. 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. 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. 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. (not hard to find)

Install software dependencies to get your express server up and running.

EG: node, npm, express

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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