apt-get install nginx
存放配置文件/etc/nginx
nginx重新加載
nginx -s reload
查看使用的端口
netstat -apn | grep :80
,ps -ef | grep nginx
kill -9 4183卸載nginx
sudo apt-get purge nginx nginx-common
# 卸載所有東東矗愧,包括刪除配置文件pm2
npm install pm2 -g
pm2 status
//是否有表格輸出
普通啟動(dòng)(fork模式旨枯,無法處理并發(fā))
pm2 start app.js
重啟某個(gè)項(xiàng)目pm2 restart 0
pm2 restart 項(xiàng)目Id
重啟所有項(xiàng)目
pm2 restart all
pm2 stop 0
停止指定的進(jìn)程
pm2 delete 0
殺死指定的進(jìn)程
集群啟動(dòng)(cluster模式,可處理并發(fā))
pm2 start app.js -i 0
查看pm2中的項(xiàng)目運(yùn)行狀態(tài)
pm2 l
pm2 list
pm2 status
- nodejs配置https, 注意免費(fèi)的ssl證書1年有效
let express = require("express");
let http = require("http");
let https = require("https");
let fs = require("fs");
// Configuare https
const httpsOption = {
key : fs.readFileSync("./https/xxxxxxxxxxxx.key"),
cert: fs.readFileSync("./https/xxxxxxxxxxxx.pem")
}
// Create service
let app = express();
app.get('/', function (req, res) {
res.send('Hello World! https!');
});
http.createServer(app).listen(80);
https.createServer(httpsOption, app).listen(443);
Nodejs配置Https服務(wù)1
Nodejs配置Https服務(wù)1