tty一款基于浏览器的终端模拟器。
下载:https://nodejs.org/dist/v0.12.3/node-v0.12.3-linux-x64.tar.gz
$ cd /home $ wget https://nodejs.org/dist/v0.12.3/node-v0.12.3-linux-x64.tar.gz $ tar -zxvf node-v0.12.3-linux-x64.tar.gz $ cd node-v0.12.3-linux-x64 $ ln -s /home/node-v0.12.3-linux-x64/bin/node /usr/local/bin/node # 软连接 $ ln -s /home/node-v0.12.3-linux-x64/bin/npm /usr/local/bin/npm # 软连接 $ node -v v0.12.3
下载:https://www.python.org/ftp/python/2.6.9/Python-2.6.9.tgz
$ cd /home $ wget https://www.python.org/ftp/python/2.6.9/Python-2.6.9.tgz $ tar -zxf Python-2.6.9.tgz $ cd Python-2.6.9 $ ./configure --prefix=/usr/local/python2.6 # 编译 $ make && make install # 安装 $ ln -s /usr/local/python2.6/bin/python2.6 /usr/bin/python # 软连接 $ python -V Python 2.6.9
$ cd /var/www $ mkdir nodejs $ cd nodejs $ mkdir nodejs-tty $ cd nodejs-tty $ npm install tty.js # 成功了...这背后得有多少坎坷啊
var tty = require('tty.js');
var conf = tty.config.readConfig()
, app = tty.createServer(conf);
app.get('/foo', function(req, res, next) {
res.send('bar');
});
app.listen();
"users": {
"hello": "world"
},
"https": {
"key": "./server.key",
"cert": "./server.crt"
},
"port": 3000,
// "hostname": "127.0.0.1",
"shell": "bash",
"shellArgs": ["arg1", "arg2"],
"static": "./static",
"limitGlobal": 10000,
"limitPerUser": 1000,
"localOnly": false,
"cwd": ".",
"syncSession": false,
"sessionTimeout": 600000,
"log": true,
"io": {
"log": false
},
"debug": false,
"term": {
"termName": "xterm",
"geometry": [80, 24],
"scrollback": 1000,
"visualBell": false,
"popOnBell": false,
"cursorBlink": false,
"screenKeys": false,
"colors": [
"#2e3436",
"#cc0000",
"#4e9a06",
"#c4a000",
"#3465a4",
"#75507b",
"#06989a",
"#d3d7cf",
"#555753",
"#ef2929",
"#8ae234",
"#fce94f",
"#729fcf",
"#ad7fa8",
"#34e2e2",
"#eeeeec"
]
}
}
$ node /var/www/nodejs/nodejs-tty/index.js
$ node /var/www/nodejs/nodejs-tty/index.js & # 加&:放到后台运行 $ jobs # 查看后台进程 [1]+ Running node index.js &
若用jobs无法查看到后台 tty.js 进程,则用端口来查找对应的进程:
$ netstat -anp|grep 3000 # 端口使用情况 $ lsof -i :3000 # 查找出占用3000端口的进程 $ kill -9 [pid] # 杀死进程
作者:
信息录入:
文案编辑:
视频录制:
视频编辑:
图片编辑:
关键字修改: