一:安装http-server
# 安装 Node.js 和 npm(包管理器)
# Ubuntu/Debian
sudo apt install nodejs npm -y
# CentOS/RHEL
sudo dnf install nodejs npm -y
# 全局安装 http-server
sudo npm install -g http-server
二:部署html站点
1.上传html站点
将你的html站点上传到指定目录,例如:/www/wwwroot/html
2.启动http-server
# 进入html站点目录
cd /www/wwwroot/html
# 启动 http-server(默认端口 8080)
http-server
# 可选:指定端口(比如 80,需要 sudo)
# sudo http-server -p 80
# 可选:后台运行
nohup http-server -p 80 &
三:验证访问
浏览器输入 http://你的服务器IP:8080(如果指定了 80 端口,直接输 IP 即可),就能看到静态页面。