简体   繁体   English

如何使用直接 url 访问 node.js 站点而不在 aws ubuntu、ZA03019356A9286EZ466 中提及端口 8080

[英]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.我的 node.js 应用程序在端口 8080 上运行。我想通过 url 访问它,而无需在 URL 中提及端口号。 How will i achieve this?我将如何实现这一目标?

for example: current: www.domainname.com:8080例如:当前:www.domainname.com:8080

Expected:www.domainname.com预期:www.domainname.com

Ubuntu os version: 16 Server: Apache2 Ubuntu 操作系统版本:16 服务器:Apache2

Need help.需要帮忙。

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)使用 Nginx 作为您的节点 js 应用程序的反向代理,并在 nginx 配置文件中提及您的端口。(您可以创建新的配置文件,也可以使用默认的 /etc/nginx/nginx.conf)

Install pm2 and Use pm2 tool to keep running your nodejs application in the background.安装 pm2 并使用 pm2 工具在后台继续运行您的 nodejs 应用程序。

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 )

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM