node部署到騰訊雲Linux服務器
參考鏈接:https://www.cnblogs.com/OhIAmFine/p/6860388.html
騰訊雲註冊、購買服務器
(本文是 cantus 64)
linux 環境
這裏推薦一個終端軟件 MobaXterm
-
登陸服務器
ssh [email protected]
// root是賬號 後面是服務器外網地址 -
更新node
n latest
// 能按照最新的node.js -
測試node
編寫js文件:
// start.js
const http = require('http');
const hostname = '10.154.208.237';//服務器上的內網ip
const port = 8003;//端口
const server = http.createServer((req, res) => {
res.statusCode = 200;
res.setHeader('Content-Type', 'text/html');
res.end('hello world');
});
server.listen(port,hostname,() => {
console.log('success in',hostname,port);
});
然後測試:
node start.js
- node項目部署(當然最好打包)
!!!Problem
- 端口被佔用
解決:
Mysql 安裝
嘗試了很多總有問題,多半要先卸載再重裝,參考下文:
- 先更新yum
更新yum軟件包
yum check-update
更新系統
yum update
- 再按下面
https://blog.csdn.net/zhwyj1019/article/details/80274269