大概記錄一下需要什麼樣的流程,因為 yum 裡面沒有 1. 先在機器上裝需要的 library 以及 tool > sudo yum install gcc-c++ openssl-devel make 2. 下載 node-js 最新的 source ,可以到 http://nodejs.org/ 找。 > wget 'http://nodejs.org/dist/node-v0.4.7.tar.gz' > tar zxf node-v0.4.7.tar.gz > cd node-v0.4.7 > ./configure > make > sudo make install 安裝完成! 3. 來個 hello world 測試一下吧,把 http://nodejs.org/ 首頁的範例拿來用 var http = require('http'); http.createServer(function (req, res) { res.writeHead(200, {'Content-Type': 'text/plain'}); res.end('Hello World\n'); }).listen(1337, "127.0.0.1"); console.log('Server running at http://127.0.0.1:1337/'); 把他存入 example.js > node example.js & Server running at http://127.0.0.1:1337/ > GET http://127.0.0.1:1337/ Hello World > 成功啦! 再來用 sudo yum install httpd 裝個 httpd ,不過只是為了用裡面 ab 來測測看效能而已。 > ab -n 1000 -c 10 http://127.0.0.1:1337/ Requests per second: 4199.62 [#/sec] (mean) Time per request: 2.381 [ms] (mean) Time per request: 0.238 [ms] (mean, across all concurrent requests) 超級快的, 4000qps 耶
文章標籤
全站熱搜
創作者介紹
創作者 榮尼王 的頭像
榮尼王

Ronny's BLOG

榮尼王 發表在 痞客邦 留言(0) 人氣(0)