常用命令速查包
关于auto_okx命令的
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| sudo systemctl status auto_okx
ls /etc/systemd/system/*.service
sudo systemctl restart auto_okx
sudo systemctl stop auto_okx
sudo systemctl start auto_okx
sudo systemctl is-enabled auto_okx
sudo systemctl enable auto_okx
sudo tail -f /home/ubuntu/okx/logs/trade_$(date +%Y-%m-%d).log
sudo tail -50 /home/ubuntu/okx/logs/trade_$(date +%Y-%m-%d).log
|
查看go api的相关命令
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| go api help
sudo systemctl status okx-api
sudo systemctl -u okx-api -f
sudo systemctl restart okx-api
sudo systemctl stop okx-api
sudo systemctl start okx-api
sudo systemctl is-enabled okx-api
sudo systemctl enable okx-api
|
nginx命令
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| sudo systemctl status nginx
sudo systemctl reload nginx
sudo systemctl restart nginx
sudo nginx -t
ls -l /etc/nginx/sites-enabled/
cat /etc/nginx/sites-enabled/api.xtwa.org
|
查看防火墙状态
1 2 3 4 5 6 7 8 9
| sudo ufw status
sudo ufw allow 22/tcp sudo ufw allow 80/tcp sudo ufw allow 443/tcp
|
系统资源
系统资源
1 2 3 4 5 6
| free -h
top -bn1 | head -5
|
绑定域名
安装 Nginx
1
| sudo apt update &&sudo apt install -y nginx
|
安装 Certbot(Let’s Encrypt SSL 证书)
1
| apt install -y certbot python3-certbot-nginx
|
配置 Nginx 反向代理
1
| sudo vim /etc/nginx/sites-available/api.xtwa.org
|
1 2 3 4 5 6 7 8 9 10 11 12 13
| 写入配置 server { listen 80; server_name api.xtwa.org;
location / { proxy_pass http://127.0.0.1:8080; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; } }
|
启动 Nginx 配置
1 2 3 4
| 启动配置 ln -s /etc/nginx/sites-available/api.xtwa.org /etc/nginx/sites-enabled/ nginx -t systemctl reload nginx
|
申请证书
1 2 3
| 申请证书会自动配置,但是如果用的是cloudfare的代理那么自带https则不用申请自动配置证书
certbot --nginx -d api.xtwa.org
|
更新系统包
1 2 3 4 5 6 7 8 9 10 11 12 13
| sudo apt update && sudo apt upgrade -y
sudo apt install nginx -y
sudo systemctl start nginx
sudo systemctl enable nginx
sudo systemctl status nginx
|
#