安装 Docker

1
2
# 使用官方一键安装命令
curl -sSL https://get.docker.com/ | sh

配置

详细参考Hysteria2 官方文档

1
2
3
4
5
6
7
8
9
10
11
12
13
14
# docker-compose.yaml
version: "3.9"
services:
hysteria:
image: tobyxdd/hysteria
container_name: hysteria
restart: always
network_mode: "host"
volumes:
- acme:/acme
- ./hysteria.yaml:/etc/hysteria.yaml
command: ["server", "-c", "/etc/hysteria.yaml"]
volumes:
acme:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# hysteria.yaml
listen: :50443 # 自定义监听端口,不填默认443

acme:
domains:
- test.example.con # 指向服务器的域名
email: [email protected]

auth:
type: password
password: 123456 # 注意改复杂密码

masquerade: # 下面的可以不需要
type: proxy
proxy:
url: https://www.baidu.com # 伪装网站
rewriteHost: true

只演示最简配置,详情请查看官方文档

运行

1
2
docker-compose up -d
docker logs hysteria # 查看日志是否运行成功

Calsh 配置

1
2
3
4
5
6
7
8
9
# clash.yaml
proxies:
- name: hysteria
type: hysteria
server: test.example.con
port: 50443
password: 123456
up: 100 # 这两项建议用 speedtest.cn 测速的值来填
down: 1000

一键安装脚本

1
2
# 根据上述操作写的一个脚本,可能有错,自行修改
curl -O https://raw.githubusercontent.com/jesongit/script/main/linux/hy2.sh && bash hy2.sh