自定义shell
-
zsh 安装
- apt-get update
- apt-get install zsh
-
更换shell为zsh
chsh -s /usr/bin/zsh
chsh 负责查看和修改系统登录的shell
-
查看已安装的shell:chsh -l
-
查看当前使用的shell:echo $SHELL
-
Oh-my-zsh 安装
下载oh-my-zsh
$ sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
curl :客户端client的URL工具,类似于postMan。curl的用法:阮一峰 点击查看
sh -c string:命令从-c后的字符串读取。 -i:实现脚本交互。 -n:进行shell脚本的语法检查。 -x:实现shell脚本逐条语句的跟踪。
oh-my-zsh 主题设置
ssh 超时断开链接 问题
两种方法,修改一次即可,推荐修改客户端
-
修改客户端:
修改ssh下的ssh_config
vim /etc/ssh/ssh_config
添加下面代码
ServerAliveInterval 60
-
修改服务端:
vim /etc/ssh/ssh_config
添加下面代码
ClientAliveInterval 60
ssh 密匙登陆
本地机器操作:
ssh-keygen
生成密匙,ssh-copy-id root@x.x.x.x
将公钥传送到远程主机
Node 安装
- nvm 管理工具下载:
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.2/install.sh | bash
-
source ~/.nvm/nvm.sh
-
nvm install node
-
nvm use node
nginx 安装
debian :apt install nginx
即可
测试是否安装并运行:systemctl status nginx
或者浏览器输入服务器地址出现nginx 即表示成功
nginx 配置:/etc/nginx/conf.d/
upstream hello {
server 127.0.0.1:[node服务的端口号];
}
server {
listen 80;
server_name [你的域名地址或者ip地址];
location / {
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Nginx-proxy true;
proxy_pass http://hello;
proxy_redirect off;
}
}
nginx -t
查看当前配置是否成功
简单测试
npm init -y && npm i koa
vim hello.js
hello.js
const Koa = require("koa");
const PORT = 9527;
const server = new Koa();
server.use(ctx=>{
ctx.body = "<h1>hello wolrd</h1>"
})
server.listen(PORT, () => {
console.log("app start")
});
执行:
-> node hello.js
app start
浏览器输入域名或控制台输入curl [域名]
-> curl backup.limiaomiao.site
<h1>hello wolrd</h1>