Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Node.js - How can I remove the port from the url? [closed]

I use the node.js and socket.io.

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

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?

like image 415
Jenan Avatar asked Mar 02 '12 00:03

Jenan


People also ask

How do I get the full URL in NodeJS?

To get the full URL in Express and Node. js, we can use the url package. to define the fullUrl function that takes the Express request req object.

How do I remove a server from NodeJS?

File. delete() method from the Node. JS SDK is expecting the path of the file to remove from disk. Note: The path of the file is relative to the root of your application.


1 Answers

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.

like image 132
sarnold Avatar answered Sep 22 '22 04:09

sarnold