安装或升级到最新版本 Hysteria 2:

bash <(curl -fsSL https://get.hy2.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

服务端配置文件

listen: :443
 
# 以下 acme 和 tls 字段,二选一
# 有域名部署的选择 acme ,无域名的选择 tls
# 选择 acme,必须注释掉 tls,反之一样
 
acme:
  domains:
    - cn2.bozai.us        # 域名
  email: your@email.com   # 邮箱,格式正确即可
 
#tls:
#  cert: /etc/hysteria/server.crt
#  key: /etc/hysteria/server.key
 
auth:
  type: password
  password: 88888888   # 请及时更改密码
 
masquerade:
  type: proxy
  proxy:
    url: https://bing.com # 伪装网站
    rewriteHost: true

服务相关命令

systemctl start hysteria-server.service    # 启动 hysteria 服务
systemctl enable hysteria-server.service   # 设置 hysteria 服务 开机自启
systemctl restart hysteria-server.service  # 重启 hysteria 服务
systemctl stop hysteria-server.service     # 停止 hysteria 服务
systemctl status hysteria-server.service   # 查看 hysteria 服务 状态

客户端配置文件

server: ip:443
auth: ****
 
#bandwidth:
#  up: 20 mbps
#  down: 100 mbps
  
tls:
  sni: cn2.bozai.us  # 若无域名,请改为 bing.com
  insecure: false    # 若无域名,需要改参数为 true
 
socks5:
  listen: 127.0.0.1:1080
http:
  listen: 127.0.0.1:8080

最后修改:2024 年 04 月 13 日
如果觉得我的文章对你有用,请随意赞赏