pm2部署指令
pm2 deploy ecosystem.json production setup
pm2 deploy ecosystem.json production
配置文件:
//ecosystem.json
{
"apps": [{
"name": "Ice",
"script": "server.js",
"env": {
"COMMON_VARIABLE": "true"
},
"env_production": {
"NODE_ENV": "production"
}
}],
"deploy": {
"production": {
"user": "root",
"host": ["120.79.3.xxx"],
//"port": "39999",
"ref": "origin/master",
"repo": "git@code.aliyun.com:lxx2013/ice.git",
"path": "/home/www/ice/production",
"ssh_options": "StrictHostKeyChecking=no",
"pre-deploy-local": "echo 'Deploy Done!'",
"env": {
"NODE_ENV": "production"
}
}
}
}
CentOS7 pm2 部署node错误提示pm2: command not found]
lxx@imac:~/Desktop/nodejs/ice$ pm2 deploy ecosystem.json production
--> Deploying to production environment
--> on host 120.79.3.108
○ deploying origin/master
○ executing pre-deploy-local
Deploy Done!
○ hook pre-deploy
○ fetching updates
○ full fetch
正在获取 origin
○ resetting HEAD to origin/master
HEAD 现在位于 e286cc6 =>aliyun
○ executing post-deploy `export NODE_ENV=production && pm2 startOrRestart ecosystem.json --env production`
bash: pm2: 未找到命令
post-deploy hook failed
Deploy failed
1
解决方法:
whereis pm2
pm2: /opt/nodejs/bin/pm2
sudo ln -s /opt/nodejs/bin/pm2 /usr/bin/pm2
nginx http重定向https正确写法
server {
listen 80;
server_name my.domain.com;
return 301 https://$server_name$request_uri;
}
server {
listen 443 ssl;
server_name my.domain.com;
[....]
}
网友评论