安装docker

1
2
3
4
5
curl -fsSL https://get.docker.com | bash
systemctl start docker
service docker start
systemctl enable docker.service
systemctl status docker.service

webdav

1
2
3
4
cd /root/app/webdav
wget https://hub.fastgit.org/hacdias/webdav/releases/download/v4.1.1/linux-arm64-webdav.tar.gz
tar -xvzf linux-arm64-webdav.tar.gz
vi /root/app/webdav/config.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# Server related settings
address: "[::]"
port: 15108
auth: true
tls: false
cert: cert.pem
key: key.pem

# Default user settings (will be merged)
scope: .
modify: true
rules: []

users:
- username: zaqai
password: jamay569
scope: /xa

创建服务项, 使得可以使用systemctl控制服务

vi /usr/lib/systemd/system/webdav.service

1
2
3
4
5
6
7
8
9
10
11
12
[Unit]
Description=WebDAV server
After=network.target

[Service]
Type=simple
User=root
ExecStart=/root/app/webdav/webdav --config /root/app/webdav/config.yaml
Restart=on-failure

[Install]
WantedBy=multi-user.target
1
2
3
systemctl daemon-reload
systemctl enable webdav
systemctl start webdav

docker 换源

使用场景: 拉取镜像

报错, 但网是通的

vi /etc/docker/daemon.json

1
2
3
4
{
"registry-mirrors": ["https://bytkgxyr.mirror.aliyuncs.com","https://registry.docker-cn.com","http://hub-mirror.c.163.com"],
"live-restore": true
}

docker webdav-aliyundriver

获取refreshToken

1
2
3
4
5
6
7
docker run -d --name=webdav-aliyundriver --restart=always -p 38080:8080  -v /etc/localtime:/etc/localtime -v /etc/aliyun-driver/:/etc/aliyun-driver/ -e TZ="Asia/Shanghai" -e ALIYUNDRIVE_REFRESH_TOKEN="1f39cc0494dd4deab22c96771b6c5ccb" -e ALIYUNDRIVE_AUTH_PASSWORD="admin" -e JAVA_OPTS="-Xmx1g" zx5253/webdav-aliyundriver

# 将your refreshToken替换为上面获取的refreshToken
# 8080:8080 第一个8080为服务器webdav服务的端口,可修改
# /etc/aliyun-driver/ 挂载卷自动维护了最新的refreshToken,建议挂载
# ALIYUNDRIVE_AUTH_PASSWORD 是admin账户的密码,建议修改
# JAVA_OPTS 可修改最大内存占用,比如 -e JAVA_OPTS="-Xmx512m" 表示最大内存限制为512m

挂载WebDav方法

1
2
3
4
5
yum -y install davfs2
sed -i 's/# use_locks 1/use_locks 0/g' /etc/davfs2/davfs2.conf
echo "192.168.1.111:38085 zaqai jamay569" >> /etc/davfs2/secrets #保存用户名密码,以后可以直接免密码挂载
mount.davfs 192.168.1.111:38085 /ali
echo "mount.davfs 192.168.1.70:15108 /ali" >> /etc/rc.local # 开机自动挂载

一些nginx骚操作

  • 使用Nginx进行TCP/UDP/IPV6端口转发

    要在编译安装时添加stream模块, 亲测宝塔的编译安装会安装此模块

    1
    vi nginx.conf # nginx主配置文件
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    stream {
    #将12345端口转发到192.168.1.23的3306端口
    server {
    listen 12345;
    proxy_connect_timeout 5s;
    proxy_timeout 20s;
    proxy_pass 192.168.1.23:3306;
    }
    #将udp 53端口转发到192.168.1.23 53端口
    server {
    listen 53 udp reuseport;
    proxy_timeout 20s;
    proxy_pass 192.168.1.23:53;
    }
    #ipv4转发到ipv6
    server {
    listen 9135;
    proxy_connect_timeout 10s;
    proxy_timeout 30s;
    proxy_pass [2607:fcd0:107:3cc::1]:9135;
    }
    }
    1
    nginx -s reload
  • nginx代理socket端口

    要在编译安装时添加stream模块, 亲测宝塔的编译安装会安装此模块

    1
    vi nginx.conf # nginx主配置文件
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    stream{
    upstream socket_server{
    server 127.0.0.1:3802 weight=1;#发布socket1服务端口
    server 127.0.0.1:3803 weight=1;#发布socket2服务端口
    }
    #监听socket端口
    server {
    listen 3801;
    proxy_pass socket_server;
    }
    }
    1
    nginx -s reload

    至于用处嘛, 当然是让只有ipv4的设备使用上ipv6的ss

    虽然有点多此一举, 但众所周知, ipv4的ss容易被封, 本人一台vultr的ss, ipv6正常, 换成ipv4就不能使用, (怀疑是某些端口被封)

    通过一个双栈的nginx就可以将ss的ipv6转换成本地的ipv4

ssr低延迟

1
2
3
4
5
6
7
8
9
yum -y install wget

wget -N — no-check-certificate https://raw.githubusercontent.com/ToyoDAdoubi/doubi/master/ssr.sh && chmod +x ssr.sh && bash ssr.sh

wget — no-check-certificate https://github.com/teddysun/across/raw/master/bbr.sh

chmod +x bbr.sh

./bbr.sh