开篇唠唠嗑

最近有空就在谋划着AllInOne这个事情,讲道理这个概念我也是知道不久,但刚好符合我的需求,私密使用docker搭建wiz,nextcloud,gitlab,bark,aria2等等,这应该算是我的兴趣爱好吧。。。下面的这些工具都是非常简单的说明了我怎么用,并没有教程啥的,所以如果想学的话我可以说下这些工具的作用,但你自己要找下教程去学。

  • 第一个是bbr,这个是一个让境外服务器的连接体验变好的工具,如果你的服务器在国外可以去使用这个。我呢是拿它优化一下网络,但别指望它能怎样,比不优化要好一些,我用的是bbr plus,不同服务器最好都测试一下其他的方法,万一有更好用的呢?
  • 第二个是v2ray,百度一下吧。
  • 第三个是caddy,让http加个s。这个挺好用的,配置也简单。证书到期可以自动“续费”。我是拿来外部http连接上个s。比如说bark程序加个s。
  • 第四个是acme.sh,跟第三个差不多,不过我是拿来内部frp连接时候加一个s。
  • 第五个是frp,内网穿透专用,不熟悉这个概念百度一下。AllInOne灵魂,没有这个的AllInOne就是一个Nas + 软路由。
  • 第六个bark,就是一个iPhone上的信息提醒软件,通过http的get方法可以实时发送信息到iphone上,配合RSS可以实时检测你想要的信息流。自定义RSS还可以拿来抢某些优惠券等等。安卓的用户可以使用Server酱,我也在用。我目前拿这个来每小时检测我的内网AllInOne服务器是否正常使用。一旦断网或者死机了能提醒一下。
  • 第七个就是Linux上的crontab,定时运行程序,配合bark做监控服务器是否正常使用。

bbr

1
2
3
wget -N --no-check-certificate "https://raw.githubusercontent.com/chiakge/Linux-NetSpeed/master/tcp.sh"
chmod +x tcp.sh
./tcp.sh

install v2ray

1
bash <(curl -s -L https://git.io/v2ray.sh)

install caddy

1
2
3
4
sudo apt install -y debian-keyring debian-archive-keyring apt-transport-https
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/cfg/gpg/gpg.155B6D79CA56EA34.key' | sudo apt-key add -
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/cfg/setup/config.deb.txt?distro=debian&version=any-version' | tee -a /etc/apt/sources.list.d/caddy-stable.list
apt update && apt install -y caddy

nano /etc/caddy/Caddyfile

1
2
3
4
5
6
{
email root@example.com
}
example.com {
reverse_proxy 127.0.0.1:80
}

acme.sh(aliyun)

1
2
3
4
curl  https://get.acme.sh | sh
export Ali_Key=""
export Ali_Secret=""
.acme.sh/acme.sh --issue --dns dns_ali -d example.com

frp

1
2
3
4
5
6
7
8
# https://github.com/fatedier/frp/releases 
# bash shell
# Server
./frps -c ./frps.ini &
disown %1
# Client
./frpc -c ./frpc.ini &
disown %1

frps.ini

1
2
3
4
5
6
7
8
[common]
bind_port =7000
bind_udp_port =7000
tls_only = true
tls_enable = true
tls_cert_file = /root/.acme.sh/example.com/example.com.cer
tls_key_file = /root/.acme.sh/example.com/example.com.key
tls_trusted_ca_file = /root/.acme.sh/example.com/ca.cer

frpc.ini

1
2
3
4
5
6
7
8
9
10
11
12
13
[common]
server_addr = example.com
server_port = 7000
tls_enable = true
tls_cert_file = ./example.com/example.com.cer
tls_key_file = ./example.com/example.com.key
tls_trusted_ca_file = ./example.com/ca.cer

[http]
type = tcp
local_ip = 127.0.0.1
local_port = 80
remote_port = 8080

bark

1
2
3
# install docker
curl -fsSL get.docker.com | sh
docker run -dt --name bark -p 8080:8080 finab/bark-server

crontab

1
10 * * * * /usr/bin/python3  /root/ServerIsRunning.py

ServerIsRunning.py

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import requests, time
def send():
my_keys = ''
title = 'Hongkong Server is destroyed!'
body = 'Hongkong Server is destroyed!'
msg_url = "https://bark.example.com/{}/{}/{}?sound=anticipate".format(my_keys, title, body)
requests.get(msg_url)

try:
r = requests.get('https://example.com/')
time.sleep(5)
if (r.status_code != 200):
send()
except Exception:
send()