admin管理员组文章数量:1666070
node 14.16.1
nginx 1.18.0
mysql 8.0.26
nginx 静态高性能的HTTP和反向代理web服务器
nginx主配置文件
/usr/local/lighthouse/softwares/nginx/conf/nginx.conf
vim /usr/local/lighthouse/softwares/nginx/conf/nginx.conf
立即进入,如图:
按i可修改
#注释
按Esc键 ,:wq 按Enter键保存并退出
cd /usr/local/lighthouse/softwares/nginx/html
ls
nginx重启刷新
systemctl restart nginx.service
查看nginx进程
ps aux|grep nginx
刷新前:
刷新后:
index.html
50x.html
1.vue项目部署
项目url
前端接口路径localhost应全部替换为公网IP
cd /usr/local/lighthouse/softwares/nginx/html
ls
rm -rf index.html
rz
ls
unzip dist.zip
ls
sudo vim /usr/local/lighthouse/softwares/nginx/conf/nginx.conf
按i可修改
root html/dist
server_name 域名或公网IP
按Esc键 ,:wq 按Enter键保存并退出
nginx重启刷新
systemctl restart nginx.service
vue前端已完成
2.node项目部署
查看 Node.js 版本信息
安装 Node.js 多版本(可选)
1.执行以下命令,安装 git。
yum install -y git
2.执行以下命令,下载 NVM 源码并检查最新版本。
git clone https://github/cnpm/nvm.git ~/.nvm && cd ~/.nvm && git checkout `git describe --abbrev=0 --tags`
3.执行以下命令,配置 NVM 环境变量。
echo ". ~/.nvm/nvm.sh" >> /etc/profile
4.执行以下命令,读取环境变量。
source /etc/profile
5.执行以下命令,查看 Node.js 所有版本。
nvm list-remote
6.依次执行以下命令,安装多个版本的 Node.js
nvm install v16.15.0
nvm install v18.5.0
7.执行以下命令,查看已安装的 Node.js 版本。
nvm ls
8.执行以下命令,切换 Node.js 使用版本
nvm use v16.15.0
121.4.57.230
除了node_modules
node项目,随便放我就放在这里好了
cd /usr/local
mkdir serve
cd serve
上传node项目
rz
别中断,上传需要时间,上传之前,记得把所有文件先保存,不然真的会卡死
unzip app.zip
ls
npm --registry https://registry.npm.taobao install
嫌原来的压缩包会占空间,可以删掉,
出现3000端口被占用是nginx反向代理的问题
原因是端口号80被其它程序或文件占用了,那么就干掉这个程序吧
sudo fuser -k 3000/tcp
这个端口不好用,老是被占用,自己可以新开一个
pm2的安装
npm --registry https://registry.npm.taobao install pm2 -g
pm2的基本使用
pm2 start app.js
node后端已完成
react 单页面也可采用上述一样方法部署到服务器
mognodb也一样
版权声明:本文标题:vue+mysql+node.js项目部署到腾讯云-云服务器轻量应用服务器 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://www.elefans.com/dianzi/1730064284a1221234.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论