Home > Net >  How to link node express server to domain
How to link node express server to domain

Time:08-05

I have a domain name pointing to my vps IP. But when I run my express server I have to set a port, usually I use 3000, so the only way to get in my website is specifying the port: www.mysite.com:3000.

How can I make my app run in my domain without adding any port? My first guess was setting also the port in my domain name provider (111.11.11.11:3000) but Godaddy doesn't let me to add the port.

How can I make it work?

Newbie question, I know, but i'm a first timer and haven't found any answer to this.

CodePudding user response:

The correct way is to change the port its hosted on. The default port for http traffic is 80, the one for https is 443. I assume you are on linux, if so you need to give some special permissions as ports below 1024 are privileged ports.

TLDR: if running http, change your express config to 80, if https 443

CodePudding user response:

If using express, you need to change express port from 3000 to 80 if you plan using HTTP or 443 if you plan using HTTPS.

This is assuming your VPS does not already use port 80 or 443 while running an HTTP server like apache or nginx.

If you are in this case you will need to set up a reverse proxy.

  • Related