Node.js是一套用来编写高性能网络服务器的JavaScript工具包,一系列的变化由此开始。比较独特的是,Node.js会假设在POSIX环境下运行Linux 或 Mac OS X。如果是在Windows下,那就需要安装MinGW以获得一个仿POSIX的环境。在Node中,Http是首要的。Node为创建http服务器作了优化,所以在网上看到的大部分示例和库都是集中在web上。本文只是node.js的简单安装与配置,注意此版本的nodejs安装python2.7安装python2.71.去官网下载python2.7http://python.org2.解压与编译tar xvf Python-2.7.5.tar.bz2cd Python-2.7.5./configure --prefix=/usr/local/python2.7make&&make installln -s /usr/local/python2.7/bin/python2.7 /usr/bin/python2.7 #做一个链接,或者吧/usr/local/python2.7/bin/加到PATH变量中1.去官网下载nodejs v0.10.7安装包,注意选择INSTALL2.解压与编译tar xvf node-v0.10.7.tar.gzcd node-v0.10.7./configuremake&&make install3.编写一个js文件#vim test.jsvar http = require("http");
http.createServer(function (req, res) { res.writeHead(200, {"Content-Type": "text/plain"}); res.end("Hello World
");}).listen(8080, "127.0.0.1");console.log("Server running at http://127.0.0.1:8080/");node test.js & #后台运行4.访问elinks http://127.0.0.1:8080/这时候应该就可以看到hello world了更多关于Node.js的详细信息,或者下载地址请点这里Ubuntu 12.04 + 虚拟机VMware 9 + Secure CRT + EditPlus 本地C++开发环境搭建VMware下安装Gentoo的几个小问题相关资讯 Node.js Node.js安装 Node.js配置
- Node.js v7 Beta版引入citgm (今 10:08)
- 基于Docker部署Node.js应用环境 (09月26日)
- Linux下Node.js安装过程详解 (07月26日)
| - Node.js HTTP Web 服务器代码 (09月26日)
- Ubuntu 16.04 64位 搭建 Node.js (09月25日)
- 在CentOS下安装Node.js (07月12日)
|
本文评论 查看全部评论 (0)