Santosh Kumar Sahu
Santosh Kumar Sahu

Reputation: 27

How to access node.js site with direct url without mentioning port 8080 in aws ubuntu, Apache2

My node.js application is running on port 8080. I want to access it via url without mentioning port number in the URL. How will i achieve this?

for example : current : www.domainname.com:8080

Expected :www.domainname.com

Ubuntu os version: 16 Server : Apache2

Need help.

Upvotes: 1

Views: 148

Answers (1)

mahendra rathod
mahendra rathod

Reputation: 1638

Use Nginx as a reverse proxy for your node js application and mentioned your port in nginx config file.(you can create new config file or you can use default one /etc/nginx/nginx.conf)

Install pm2 and Use pm2 tool to keep running your nodejs application in the background.

curl -sL https://deb.nodesource.com/setup_10.x | sudo bash -
sudo apt-get install -y nodejs
sudo npm install pm2@latest -g

pm2 start myapp.config.js (replace myapp.config.js with YOURAPP.js )

Upvotes: 1

Related Questions