Run NodeJs on port 80 - node.js

I am trying to host my app on port 80. I know that it is a root port. I tried running my app with sudo, but no luck. P.S I am using Linux 16.04 LTS server. Thx!

Related

Running NodeJs application on port 80 of amazon linux

I am trying to get a NodeJs application to run on a Amazon Linux server using port 80. Currently when I run the app it is defaulting to port 1024. I understand that this is due to the fact that I have to be root to run on port 80 but given I am on a aws linux box I am not able to run that as root. I have been digging for awhile but I am coming up short on what I need to adjust to get this to run properly.
sudo bash will allow you to connect as root on your EC2 Amazon Linux instance.
I would question why do you want to run NodeJS on port 80, the best practice would have a load balancer in front of your instance to accept HTTPS calls and relay to whatever port nodejs will run on your instance, in a private subnet.
I would suggest to read this doc to learn how to do this : https://aws.amazon.com/getting-started/projects/deploy-nodejs-web-app/

Don't see nodeJs serveur port working / same port client/server don't cause error

I have an application which work with React/socket/nodeJS on a VPS.
This VPS use apache as php engine and when I check the config, it listens the port 7080.
My nodeJS work on any port 80 / 3000 / 7080 etc... and when I use netstat on my console VPS I don't see this <IP:SERVERPORT>.
Here is the problem I face:
1. Why I can't see my server PORT running on my VPS with netstats? ( I see console log from my server so he work)
2. Why it work with the same apache port? Normally I have to use a server port different from the client...
For information, my vps is dedibox (online.net with plesk).

Access Vue Application on Webpack-Server in Vagrant

I set up a virtual machine with Vagrant, ubuntu xenial64, installed npm/nodejs and the vue-cli.
I scaffolded a webpack application with vue init webpack myproject. When I now run npm run devthe webpack server starts, but since it's inside the virtual machine I can't access the webpage on my PC.
I found out, that you can run webpack server with --host 0.0.0.0 but since the Vue-Cli generates the whole process, I wasn't able to figure out where I can add this parameter.
Or is there another solution?
Ok fixed it myself :). Just add this to your Vagrantfile:
config.vm.network :forwarded_port, guest: 8080, host: 80
So nothing to do with Webpack, just basic vagrant setup. This will forward the 8080 port to 80 port of your host machine. So you need to type localhost:80 in your browser to get to your application.

Heroku running a node module server

I am trying to create a node app that runs a module called noodlejs. This starts its own server running on port 8888 (on my local version). I have pushed the changes to heroku and no errors are caused. However how do I now access the noodlejs server on port 8888? Is this possible or does it need to run on another port?
Thanks!
I don't think you can run the app on port 8888 or any other port for that matter on Heroku. You can only choose between 80 or 443. And to do that, you use process.env.PORT environment variable that Heroku exposes.

How to redirect port 80 port 900 Node Server using apache2

I have a node app running on port 9000 with forever on Ubuntu 14.04. I can simply run my app on port 80. But it needs root privileges. And I found that It's not a good idea run a server software on port 80 with root privileges. So the alternative is reverse proxy. To be honest I know nothing about reverse proxy or the way to do it. So can anyone guide to through it ?
simply what i want to do is run my node app on port 9000 and make sure it's available on port 80 using apache2.

Resources