From 8e8eb1fce678b81e9926da0f5a9b9c095246f768 Mon Sep 17 00:00:00 2001 From: dysf888 <47450409+dysf888@users.noreply.github.com> Date: Wed, 18 May 2022 10:31:37 +0800 Subject: [PATCH 1/3] =?UTF-8?q?NGINX=E5=8F=8D=E4=BB=A3tgbot=20api?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/guide/q1.md | 68 +++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 67 insertions(+), 1 deletion(-) diff --git a/docs/guide/q1.md b/docs/guide/q1.md index e8b12d9c..ca0bb936 100644 --- a/docs/guide/q1.md +++ b/docs/guide/q1.md @@ -1 +1,67 @@ -# 问题1 \ No newline at end of file +## 准备工作 +**你可以选择CloudFlare的workers进行反代,但大陆的网络你懂的,这里介绍用你自己服务器反代方式** +搭建一个TGbot api反代,你需要: +1.一个不受GFW封锁的服务器(且安装好nginx) +2.一个域名(提前申请SSL证书) +
+## NGINX配置 +编辑你nginx的配置文件,在http{}中加上如下配置 +``` +# http强制跳转到htpps +server { + listen 80; + listen [::]:80; + server_name yourDomainName; + + # 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 +``` From 6942e93e724228e8cae164ab21e72e192e3d8beb Mon Sep 17 00:00:00 2001 From: dysf888 <47450409+dysf888@users.noreply.github.com> Date: Wed, 18 May 2022 10:31:54 +0800 Subject: [PATCH 2/3] Update config.ts --- docs/.vitepress/config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/.vitepress/config.ts b/docs/.vitepress/config.ts index 9d938181..99b5dcf8 100644 --- a/docs/.vitepress/config.ts +++ b/docs/.vitepress/config.ts @@ -93,7 +93,7 @@ function getGuideSidebarZhCN() { { text: '常见问题', children: [ - { text: '问题1', link: '/guide/q1' }, + { text: 'TG api被墙', link: '/guide/q1' }, { text: '问题2', link: '/guide/q2' }, { text: '问题3', link: '/guide/q3' }, { text: '问题4', link: '/guide/q4' }, From c4894074ac32330df7d9b8739c4c224e4e641bf3 Mon Sep 17 00:00:00 2001 From: naiba Date: Wed, 18 May 2022 10:50:27 +0800 Subject: [PATCH 3/3] =?UTF-8?q?Revert=20"=F0=9F=92=84=20=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E6=9A=97=E9=BB=91=E6=A8=A1=E5=BC=8F"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 1fd3641c514f143d7112479171903fe98e375392. --- docs/.vitepress/theme/index.ts | 2 -- package-lock.json | 18 +----------------- package.json | 5 ++--- 3 files changed, 3 insertions(+), 22 deletions(-) delete mode 100644 docs/.vitepress/theme/index.ts diff --git a/docs/.vitepress/theme/index.ts b/docs/.vitepress/theme/index.ts deleted file mode 100644 index 262c5609..00000000 --- a/docs/.vitepress/theme/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -import DarkTheme from 'vitepress-dark-theme' -export default { ...DarkTheme } diff --git a/package-lock.json b/package-lock.json index c6f0ecce..e9e0b0cb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,8 +9,7 @@ "version": "1.0.0", "license": "ISC", "devDependencies": { - "vitepress": "^0.22.4", - "vitepress-dark-theme": "github:nezhahq/vitepress-dark-theme" + "vitepress": "^0.22.4" } }, "node_modules/@algolia/autocomplete-core": { @@ -1077,15 +1076,6 @@ "node": ">=14.0.0" } }, - "node_modules/vitepress-dark-theme": { - "version": "0.1.7", - "resolved": "git+ssh://git@github.com/nezhahq/vitepress-dark-theme.git#52550f5807214d139b7219a72b66b0bd9031b078", - "dev": true, - "license": "MIT", - "peerDependencies": { - "vitepress": "^0.22.4" - } - }, "node_modules/vue": { "version": "3.2.33", "resolved": "https://registry.npmjs.org/vue/-/vue-3.2.33.tgz", @@ -1851,12 +1841,6 @@ "vue": "^3.2.33" } }, - "vitepress-dark-theme": { - "version": "git+ssh://git@github.com/nezhahq/vitepress-dark-theme.git#52550f5807214d139b7219a72b66b0bd9031b078", - "dev": true, - "from": "vitepress-dark-theme@https://github.com/nezhahq/vitepress-dark-theme.git", - "requires": {} - }, "vue": { "version": "3.2.33", "resolved": "https://registry.npmjs.org/vue/-/vue-3.2.33.tgz", diff --git a/package.json b/package.json index 5d207ecd..8bd7b7cc 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,6 @@ }, "homepage": "https://github.com/nezhahq/nezhahq.github.io#readme", "devDependencies": { - "vitepress": "^0.22.4", - "vitepress-dark-theme": "github:nezhahq/vitepress-dark-theme" + "vitepress": "^0.22.4" } -} +} \ No newline at end of file