Hysteria 2 部署教程
安装 Hysteria
安装或更新
sh
bash <(curl -fsSL https://get.hy2.sh/)
卸载
sh
bash <(curl -fsSL https://get.hy2.sh/) --remove
配置服务端
生成自签证书
sh
openssl req -x509 -nodes -newkey ec:<(openssl ecparam -name prime256v1) -keyout /etc/hysteria/server.key -out /etc/hysteria/server.crt -subj "/CN=bing.com" -days 36500 && sudo chown hysteria /etc/hysteria/server.key && sudo chown hysteria /etc/hysteria/server.crt
编辑配置文件
- password - 连接密码
yaml
# /etc/hysteria/config.yaml
listen: :8443 #监听端口
tls:
cert: /etc/hysteria/server.crt
key: /etc/hysteria/server.key
auth:
type: password
password: <Password>
masquerade:
type: proxy
proxy:
url: https://bing.com
rewriteHost: true
配置客户端
- password - 服务端配置的密码
- up - 宽带上传速率
- down - 宽带下载速率
- skip-cert-verify - 使用自签证书需要为 true
yaml
- name: Hysteria 2
type: hysteria2
server: <Server IP>
port: 8443
up: 30
down: 100
password: <Password>
skip-cert-verify: true
常用命令
- 设置开机启动
systemctl enable hysteria-server
- 启动 Xray
systemctl start hysteria-server
- 关闭 Xray
systemctl stop hysteria-server
- 重启 Xray
systemctl restart hysteria-server
- 检查运行状况
systemctl status hysteria-server
预览: