Docs/Others/hysteria2/服务端-容器启动hysteria2.md

47 lines
1,004 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

## 配置文件
```shell
mkdir /etc/hysteria2
cat > /etc/hysteria2/hysteria2.yaml << EOF
# 参考: https://v2.hysteria.network/zh/docs/advanced/Full-Server-Config/
# listen: :443
acme:
domains:
# 自动生成证书
- vpn.example.com
email: text@example.com
auth:
type: password
# 自行修改密码
password: 87G9MoaEyqlNGzIzkiy3eMKk
masquerade:
type: proxy
proxy:
# 混淆反向代理的url自行修改
url: https://example.com
rewriteHost: true
listenHTTPS: :443
EOF
```
## 启动
```shell
docker pull tobyxdd/hysteria
docker run -td --restart always --name hysteria2 -p 443:443 -v /etc/hysteria2/hysteria2.yaml:/etc/hysteria2.yaml tobyxdd/hysteria -c /etc/hysteria2.yaml server
```
## 服务器放开443/udp,443/tcp
```
# 若为云上环境,安全组放开即可
# ubuntu
ufw allow 443/udp
ufw allow 443/tcp
# centos
firewall-cmd --zone=public --add-port=443/tcp --permanent
firewall-cmd --zone=public --add-port=443/udp --permanent
firewall-cmd --reload
```