无面板版
安装Hysteria:
bash <(curl -fsSL https://get.hy2.sh/)
申请证书:
apt install git -y
git clone https://github.com/slobys/acme.git /tmp/acme && mv /tmp/acme/* /root
bash acme_2.0.sh
Config文件格式:
# listen: :443
tls:
cert: your_cert.crt
key: your_key.key
auth:
type: password
password: Se7RAuFZ8Lzg
masquerade:
type: proxy
proxy:
url: https://news.ycombinator.com/
rewriteHost: true
证书文件赋予权限:
chmod 644 /etc/hysteria/.crt
chmod 644 /etc/hysteria/.key
chown root:root /etc/hysteria/.crt /etc/hysteria/.key
编辑配置文件:
nano /etc/hysteria/config.yaml
设置开机自启, 并立即启动服务:
systemctl enable --now hysteria-server.service
重启服务, 通常在修改配置文件后执行:
systemctl restart hysteria-server.service
查询服务状态:
systemctl status hysteria-server.service
日志:
journalctl --no-pager -e -u hysteria-server.service
docker搭建:
docker pull jonssonyan/h-ui
docker run -d --cap-add=NET_ADMIN \
--name h-ui --restart always \
--network=host \
-v /h-ui/bin:/h-ui/bin \
-v /h-ui/data:/h-ui/data \
-v /h-ui/export:/h-ui/export \
-v /h-ui/logs:/h-ui/logs \
jonssonyan/h-ui \
./h-ui -p 30000
如果你觉得用 Docker 比较占资源,可以直接使用二进制可执行文件
mkdir -p /usr/local/h-ui/
curl -L https://github.com/jonssonyan/h-ui/releases/latest/download/h-ui-linux-amd64 -o /usr/local/h-ui/h-ui && chmod +x /usr/local/h-ui/h-ui
curl -L https://raw.githubusercontent.com/jonssonyan/h-ui/main/h-ui.service -o /etc/systemd/system/h-ui.service
systemctl daemon-reload
systemctl enable h-ui
systemctl restart h-ui
或使用一键脚本:
bash <(curl -fsSL https://raw.githubusercontent.com/jonssonyan/h-ui/main/install.sh)