diff --git a/docs/.vitepress/config.ts b/docs/.vitepress/config.ts index aaa2ccc3..fee378d9 100644 --- a/docs/.vitepress/config.ts +++ b/docs/.vitepress/config.ts @@ -87,11 +87,11 @@ function getGuideSidebarZhCN() { { text: '常见问题', children: [ - { text: '如何进行数据迁移、备份恢复?', link: '/guide/q1' }, + { text: 'TG api被墙', link: '/guide/q1' }, { text: 'Agent 启动/上线 问题自检流程', link: '/guide/q2' }, { text: '如何反向代理 gRPC 端口', link: '/guide/q3' }, { text: '实时通道断开/在线终端连接失败', link: '/guide/q4' }, - { text: '问题5', link: '/guide/q5' } + { text: '如何进行数据迁移、备份恢复?', link: '/guide/q5' } ] } ] @@ -136,11 +136,10 @@ function getGuideSidebarEnUS() { { text: 'FAQ', children: [ - { text: 'How do I migrate my data to the new server and restore my backups?', link: '/en_US/guide/q1' }, { text: 'Let the Agent start/on-line, and the self-test process of the problem', link: '/en_US/guide/q2' }, { text: 'Reverse Proxy gRPC Port (support Cloudflare CDN)', link: '/en_US/guide/q3' }, { text: 'Real-time channel disconnection/online terminal connection failure', link: '/en_US/guide/q4' }, - { text: 'Q5', link: '/en_US/guide/q5' } + { text: 'How do I migrate my data to the new server and restore my backups?', link: '/en_US/guide/q5' } ] } ] diff --git a/docs/en_US/guide/q1.md b/docs/en_US/guide/q1.md deleted file mode 100644 index 6c207e9f..00000000 --- a/docs/en_US/guide/q1.md +++ /dev/null @@ -1 +0,0 @@ -q1 \ No newline at end of file diff --git a/docs/guide/q1.md b/docs/guide/q1.md index 1f9eb116..59d89b20 100644 --- a/docs/guide/q1.md +++ b/docs/guide/q1.md @@ -1,5 +1,67 @@ -#### 如何进行数据迁移、备份恢复? +## 准备工作 +**你可以选择CloudFlare的workers进行反代,但大陆的网络你懂的,这里介绍用你自己服务器反代方式** +搭建一个TGbot api反代,你需要: +1.一个不受GFW封锁的服务器(且安装好nginx) +2.一个域名(提前申请SSL证书) +
+## NGINX配置 +编辑你nginx的配置文件,在http{}中加上如下配置 +```nginx +# http强制跳转到htpps +server { + listen 80; + listen [::]:80; + server_name yourDomainName; -1. 先运行一键脚本,选择 `停止面板` -2. 在旧服务器中打包 `/opt/nezha` 文件夹,复制到新环境相同位置解压 -3. 在新环境中运行一键脚本,选择 `启动面板` \ No newline at end of file + # Enforce HTTPS + return 301 https://$server_name$request_uri; +} +## https +server { + listen 443 ssl; + listen [::]:443 ssl; + + server_name yourDomainName; + + ## ssl密钥路径自己改改 + ssl_certificate server.pem; + ssl_certificate_key server.key; + + ## root非必要 + root /var/www/tgbot/; + + ## dns必须写,不然会报502错误 + resolver 8.8.8.8; + + ## 以bot开头的请求都会被正则匹配到 + location ~* ^/bot { + proxy_buffering off; + proxy_pass https://api.telegram.org$request_uri; + proxy_http_version 1.1; + } + + ## 和上面root一样非必要,这个主要是用来确认服务器状态的。也可以改成return 403 + location /{ + try_files /$uri $uri /index.html; + } + + ## no log no fix + error_log /var/log/tg.log error; +} +``` +`yourDomainName`-你准备的域名 +`ssl_certificate`-SSL证书路径 +`ssl_certificate_key`-SSL证书路径 +
+## 使用方式 +:tada:然后执行`systemctl restart nginx`回到nezha将原来的https://api.telegram.org/ 替换为https://yourDomainName/ ,即可正常推送消息 +
+## 防止盗用 +`serverIp`-你监控鸡的ip地址,你系统安装的那个就用那个命令,ufw iptables都可. +```bash +#ubuntu +ufw allow proto tcp from serverIp to any port 443 +#centos +iptables -I INPUT -p tcp --dport 443 -j DROP +iptables -I INPUT -s serverIp -p tcp --dport 443 -j ACCEPT +``` diff --git a/docs/guide/q5.md b/docs/guide/q5.md index 948c7ebf..1f9eb116 100644 --- a/docs/guide/q5.md +++ b/docs/guide/q5.md @@ -1 +1,5 @@ -# 问题5 \ No newline at end of file +#### 如何进行数据迁移、备份恢复? + +1. 先运行一键脚本,选择 `停止面板` +2. 在旧服务器中打包 `/opt/nezha` 文件夹,复制到新环境相同位置解压 +3. 在新环境中运行一键脚本,选择 `启动面板` \ No newline at end of file