发布于 2016-10-16 10:23:38 | 247 次阅读 | 评论: 0 | 来源: 网友投递

这里有新鲜出炉的7天学会Node.js,程序狗速度看过来!

Node.js 服务器端的JavaScript

Node.js 是一个基于Chrome JavaScript 运行时建立的一个平台, 用来方便地搭建快速的 易于扩展的网络应用· Node.js 借助事件驱动, 非阻塞I/O 模型变得轻量和高效, 非常适合 运行在分布式设备 的 数据密集型 的实时应用


 ubuntu 12.04服务器可以使用apt-get方式安装Node JS,但是,安装完后的版本为v0.6.12的版本,如果我们想要使用新一点的版本需要做如下配置:

apt-get install python-software-properties
apt-add-repository ppa:chris-lea/node.js
apt-get update
apt-get install nodejs

安装完成后可以检查一下版本,使用如下命令可以查看:

root@test:#node -v
v0.10.28

 接下来我们需要安装pm2这个软件

 首先我们需要安装一个npm的软件,具体命令如下:

apt-get install npm
npm -v

安装完成,我们就可以安装pm2这个软件,使用如下命令安装:

root@test:# npm install -g pm2

在shell中输入pm,使用table补全,如果能出现pm2,说明已经正常安装。

 PM2的主要功能:

Main features

  • Built-in load balancer (using the native cluster module)

  • Script daemonization

  • 0s downtime reload for Node apps

  • Generate SystemV/SystemD startup scripts (Ubuntu, Centos...)

  • Pause unstable process (avoid infinite loop)

  • Restart on file change with --watch

  • Monitoring in console

PM2地址:https://github.com/Unitech/pm2



最新网友评论  共有(0)条评论 发布评论 返回顶部

Copyright © 2007-2017 PHPERZ.COM All Rights Reserved   冀ICP备14009818号  版权声明  广告服务