linux 安装 node.js
2014-04-19 20:44
232 查看
wget http://nodejs.org/dist/v0.10.26/node-v0.10.26.tar.gz tar zxvf node-v0.10.26.tar.gz
cd node-v0.10.26
./configure --prefix=/usr/local/bin/nodejs
make
make install
#./node -v
--关于安装支持包 NPM
默认情况下,npm获取包,会从 https://registry.npmjs.org/ 下获取,但经常会碰到网络不可用的情况
执行以下命令:
./npm config set registry http://registry.npmjs.org/
基本可以解决网络问题,顺利安装各类包
比如安装redis支持包:
./npm install redis
检查是否正常工作:
#vi index.js
运行命令:
#/usr/local/bin/nodejs/node index.js &
继续执行:
#curl http://127.0.0.1:8080/
看到输出:"Hello ,my node.js" 大功告成!
nginx怎么支持前端通过80端口访问8080端口的node.js程序?
在配置中加入:
ok,访问下地址:http://XXX.XXX.XX.XX/nodejs 试试!
cd node-v0.10.26
./configure --prefix=/usr/local/bin/nodejs
make
make install
#./node -v
--关于安装支持包 NPM
默认情况下,npm获取包,会从 https://registry.npmjs.org/ 下获取,但经常会碰到网络不可用的情况
执行以下命令:
./npm config set registry http://registry.npmjs.org/
基本可以解决网络问题,顺利安装各类包
比如安装redis支持包:
./npm install redis
检查是否正常工作:
#vi index.js
var http = require('http'); http.createServer(function(req,res){ res.writeHead(200,{'Context-Type':'text/plain'}); res.end('Hello ,my node.js\n'); }).listen(8080,"127.0.0.1");
运行命令:
#/usr/local/bin/nodejs/node index.js &
继续执行:
#curl http://127.0.0.1:8080/
看到输出:"Hello ,my node.js" 大功告成!
nginx怎么支持前端通过80端口访问8080端口的node.js程序?
在配置中加入:
location /nodejs { proxy_pass http://127.0.0.1:8080; }
ok,访问下地址:http://XXX.XXX.XX.XX/nodejs 试试!
相关文章推荐
- linux(ubuntu) 安装 node.js
- 如何在Linux上安装Node.js
- linux 安装node.js
- Linux上面安装node.js
- Linux安装node.js
- linux安装node.js
- Linux安装Node.js(源码编译安装)
- 在linux环境下安装Node.JS
- Node.js入门教程:在windows和Linux上安装配置Node.js图文教程
- 【linux】linux下安装Node.js
- Linux环境下安装Node.js
- linux环境安装node.js开发环境搭建图文教程
- 如何在Linux上安装Node.js
- Linux下更新和安装Node.js
- linux中安装node.js,配置全局环境
- Linux(centos6.0)下安装Node.js以及使用
- Linux环境下Node.js的安装配置
- Linux--CentOS-安装Node.js
- linux下安装node.js
- nodejs && npm Yeoman linux 下安装