1

I am new to node js. I am using express with node js. My node application is running properly, need a help for the remove port number from the URL. I host a site on gen 4 vps linux using cpanel. Everything is working perfectly ,but cant access domain without port number EX:

http://js4.red:8002/ This URL is working but I need to remove this port number. The correct URL should be:

http://js4.red

What is the right way to remove port from node url and run app on simple url without port?

I have tried this solution click here

Another thing to mention is The default port for http: is 80 so to remove the port from the URL it shows the directory structure

The below code shows the server configuration

var express = require("express")
var http = require("http")
var port = process.env.PORT || 8002
var server = module.exports = express();
http.createServer(server).listen(port, 'js4.red');
Rahul Patel
  • 104
  • 6
  • 1
    Just bind your server to the standard port 80 ? `http.createServer(server).listen(80, "js4.red")` . But I'm not sure I got your question well .. – Peterrabbit Feb 21 '22 at 13:06

0 Answers0