{"id":152,"date":"2026-10-29T20:47:16","date_gmt":"2026-10-29T12:47:16","guid":{"rendered":"https:\/\/xgz.app\/?p=152"},"modified":"2026-10-29T20:48:14","modified_gmt":"2026-10-29T12:48:14","slug":"%e5%88%a9%e7%94%a8-hysteria2-%e6%90%ad%e5%bb%ba%e4%b8%aa%e4%ba%ba%e4%bb%a3%e7%90%86%e8%8a%82%e7%82%b9","status":"publish","type":"post","link":"https:\/\/xgz.app\/?p=152","title":{"rendered":"\u5229\u7528 Hysteria2 \u642d\u5efa\u4e2a\u4eba\u4ee3\u7406\u8282\u70b9"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">\u68c0\u67e5\u670d\u52a1\u5668\u914d\u7f6e<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u5148<strong>\u68c0\u67e5\u4e0b\u81ea\u8eab\u670d\u52a1\u5668\u7684\u914d\u7f6e\u60c5\u51b5<\/strong>\uff0c\u672c\u6b21\u4e2a\u4eba\u8282\u70b9\u9009\u7528<code>UDP\/443<\/code>\u7aef\u53e3\uff0c\u9700\u8981\u786e\u4fdd\u672c\u7aef\u53e3\u6ca1\u6709\u88ab\u5360\u7528\uff0c\u4ee5\u53ca\u4fdd\u8bc1\u786c\u76d8\u7a7a\u95f4\u5145\u88d5<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;root@localhost ~]# ss -lntup | grep -E ':(80|443) '\n&#91;root@localhost ~]# nproc; free -h | head -2; df -h \/ | tail -1<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">\u4e0b\u8f7d\u5b89\u88c5 Hysteria 2<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u9759\u9ed8\u4e0b\u8f7d<code>Hysteria 2<\/code>\u5b98\u65b9\u7684\u5b89\u88c5\u811a\u672c<\/strong><\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;root@localhost ~]# curl -fsSL https:\/\/get.hy2.sh\/ -o \/tmp\/hy2-install.sh<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><code>-f<\/code> \u5982\u679c\u670d\u52a1\u5668\u8fd4\u56de\u9519\u8bef\uff08\u6bd4\u5982 404 \u627e\u4e0d\u5230\u6587\u4ef6\uff09\uff0c\u76f4\u63a5\u62a5\u9519\u9000\u51fa\uff0c\u4e0d\u4e0b\u8f7d\u9519\u8bef\u4ee3\u7801\u3002<br><code>-s<\/code> \u9759\u9ed8\u6a21\u5f0f\uff0c\u4e0d\u663e\u793a\u8fdb\u5ea6\u6761\u548c\u4e71\u4e03\u516b\u7cdf\u7684\u4fe1\u606f\u3002<br><code>-S<\/code> \u914d\u5408 -s \u7528\uff0c\u867d\u7136\u9759\u9ed8\uff0c\u4f46\u5982\u679c\u62a5\u9519\u4e86\uff0c\u8981\u628a\u9519\u8bef\u4fe1\u606f\u663e\u793a\u51fa\u6765\u3002<br><code>-L<\/code> \u5982\u679c\u4e0b\u8f7d\u5730\u5740\u53d1\u751f\u4e86\u91cd\u5b9a\u5411\uff0c\u81ea\u52a8\u8ddf\u7740\u8df3\u8f6c\u53bb\u4e0b\u8f7d\u6700\u7ec8\u7684\u6587\u4ef6\u3002<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u8fd0\u884c\u811a\u672c\u8fdb\u884c\u5b89\u88c5<\/strong><\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;root@localhost ~]# bash \/tmp\/hy2-install.sh\n\n&#91;root@localhost ~]# hysteria version<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u5b89\u88c5\u540e\u67e5\u770b\u4e0b\u7248\u672c\u4fe1\u606f\uff0c\u662f\u5426\u6b63\u786e\u5b89\u88c5<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u4fee\u6539\u914d\u7f6e\u6587\u4ef6<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;root@localhost ~]# vim \/etc\/hysteria\/config.yaml\n\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\nlisten: :443 \u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u53bb\u6389\u6ce8\u91ca\u7b26\u53f7\n\n# acme:\n#   domains:\n#     - your.domain.net\n#   email: your@email.com \u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u8fd9\u91cc\u662f\u6307\u8ba9\u4ed6\u81ea\u5df1\u7533\u8bf7\u8bc1\u4e66\uff0c\u6ce8\u91ca\u6389\uff0c\u6211\u4eec\u9009\u7528\u81ea\u5df1\u7533\u8bf7\u7684\u8bc1\u4e66\n\ntls:\n  cert: \/etc\/hysteria\/fullchain.pem\n  key: \/etc\/hysteria\/privkey.pem \u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u4f7f\u7528\u5df2\u6709\u8bc1\u4e66\u8fd9\u4e48\u5199\u5c31\u884c\uff0c\u4e00\u4f1a\u513f\u628a\u8bc1\u4e66\u590d\u5236\u5230\u8fd9\u4e2a\u8def\u5f84\n\nauth:\n  type: password\n  password: \u5bc6\u7801\n\nmasquerade:\n  type: proxy\n  proxy:\n    url: https:\/\/news.ycombinator.com\/ \u2014\u2014\u2014\u2014\u8981\u662f\u5bc6\u7801\u6ca1\u6709\u8f93\u5165\u6b63\u786e\uff0c\u5c31\u4f1a\u8df3\u8f6c\u5230\u8fd9\u4e2a\u7f51\u7ad9\u4ee5\u8fdb\u884c\u8ff7\u60d1\n    rewriteHost: true\n\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">\u7533\u8bf7\u8bc1\u4e66\u548c\u5bc6\u94a5<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u5982\u679c\u4f60\u5df2\u7ecf\u6709\u8bc1\u4e66\u548c\u5bc6\u94a5\u4e86\uff0c\u53ef\u4ee5\u76f4\u63a5\u8df3\u5230\u201c\u590d\u5236\u8bc1\u4e66\u5230\u6307\u5b9a\u8def\u5f84\u5e76\u8bbe\u7f6e\u6743\u9650\u201d\u90a3\u4e00\u6b65<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u7528 <code>Certbot<\/code> \u7533\u8bf7\u8bc1\u4e66\uff0c\u9700\u8981\u5b89\u88c5<code>Certbot<\/code>\u548c<code>Nginx<\/code>\u63d2\u4ef6<\/strong><\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>dnf install -y epel-release\ndnf install -y certbot python3-certbot-nginx<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u7533\u8bf7\u8bc1\u4e66<\/strong><\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>certbot --nginx -d \u57df\u540d<\/code><\/pre>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">\u5982\u679c\u56e0\u4e3a\u57df\u540d\u95ee\u9898\u62a5\u9519\uff0c\u53ef\u4ee5\u53bb\u81ea\u5df1\u8d2d\u4e70\u7684\u57df\u540d\u7f51\u7ad9\u67e5\u770b\u57df\u540d\u662f\u5426\u76f8\u540c<\/p>\n<\/blockquote>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u67e5\u770b\u7533\u8bf7\u8bc1\u4e66\u4f4d\u7f6e<\/strong><\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">\u91cc\u9762\u5e94\u8be5\u6709 <code>fullchain.pem<\/code> \u548c <code>privkey.pem<\/code>\u3002\u8fd9\u5c31\u662f\u4f60\u771f\u6b63\u7684\u8bc1\u4e66\u8def\u5f84\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u590d\u5236\u8bc1\u4e66\u5230\u6307\u5b9a\u8def\u5f84\u5e76\u8bbe\u7f6e\u6743\u9650<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u628a\u8bc1\u4e66\u590d\u5236\u5230<code>Hysteria 2<\/code>\u7684\u6307\u5b9a\u8def\u5f84<\/strong><\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;root@localhost ~]# cp -L \u8bc1\u4e66\u8def\u5f84\/*.pem \/etc\/hysteria\/<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u4fee\u6539\u8bc1\u4e66\u6743\u9650\uff0c\u8ba9<code>hysteria<\/code>\u81ea\u5df1\u4e5f\u80fd\u8bbf\u95ee<\/strong><\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;root@localhost ~]# chown hysteria:hysteria \/etc\/hysteria\/config.yaml\n&#91;root@localhost ~]# chown hysteria:hysteria \/etc\/hysteria\/\u8bc1\u4e66 \/etc\/hysteria\/\u79c1\u94a5\n&#91;root@localhost ~]# chmod 600 \/etc\/hysteria\/\u5bc6\u94a5<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u67e5\u770b\u662f\u5426\u8fd0\u884c<\/strong><\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;root@localhost ~]# systemctl start hysteria-server.service\n&#91;root@localhost ~]# systemctl status hysteria-server.service<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">\u6dfb\u52a0\u9632\u706b\u5899\u7b56\u7565<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u6dfb\u52a0\u9632\u706b\u5899\u7b56\u7565\uff0c\u653e\u884c<code>udp443<\/code>\u63a5\u53e3<\/strong><\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;root@localhost ~]# firewall-cmd --permanent --zone=public --add-port=443\/udp\n&#91;root@localhost ~]# firewall-cmd --reload<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">\u5728 v2rayN \u4e2d\u6dfb\u52a0\u8282\u70b9<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>v2rayN<\/code> \u2192 \u914d\u7f6e\u9879 \u2192 \u6dfb\u52a0 [<code>Hysteria 2<\/code>]<\/li>\n\n\n\n<li>\u5730\u5740 = \u670d\u52a1\u5668 <code>IP<\/code>\uff0c\u7aef\u53e3 = <code>443<\/code>\uff0c\u5bc6\u7801 = \u81ea\u5df1\u8bbe\u7f6e\uff0c<code>SNI<\/code> = \u57df\u540d<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">\u6dfb\u52a0\u540e\u8bbe\u7f6e\u4e3a\u6d3b\u52a8\uff0c\u4f7f\u7528\u89c4\u5219\u6a21\u5f0f<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u9a8c\u8bc1<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u6d4f\u89c8\u5668\u6253\u5f00 <a href=\"https:\/\/ipinfo.io%EF%BC%8C%E6%98%BE%E7%A4%BA%E7%9A%84%E5%BA%94%E8%AF%A5%E6%98%AF%E6%9C%8D%E5%8A%A1%E5%99%A8%E6%89%80%E5%9C%A8%E5%9C%B0%E7%9A%84\">https:\/\/ipinfo.io\uff0c\u663e\u793a\u7684\u5e94\u8be5\u662f\u670d\u52a1\u5668\u6240\u5728\u5730\u7684<\/a> IP<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">\u5982\u679c\u51fa\u73b0webRTC\u6cc4\u9732\u539fIP\u5730\u5740\u53ef\u4ee5\u5b89\u88c5\u63d2\u4ef6\u6765\u9632\u6b62<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code>adguard<\/code> \u548c<code>WebRTC Control<\/code>\u8fd9\u4e24\u6b3e\u63d2\u4ef6\u90fd\u5f88\u597d\u7528<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u67e5\u770b\u670d\u52a1\u5668\u65e5\u5fd7<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;root@localhost ~]# journalctl -u hysteria-server -n 20 --no-pager<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u9a8c\u8bc1\u662f\u5426\u6210\u529f\u8fde\u901a<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u8bbe\u7f6e\u8bc1\u4e66\u7eed\u671f\u94a9\u5b50<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\"><code>\/etc\/hysteria\/<\/code> \u91cc\u7684\u8bc1\u4e66\u662f\u526f\u672c\uff0c<code>certbot<\/code> \u7eed\u671f\u5e76\u4e0d\u4ee3\u8868\u4e5f\u4f1a\u66f4\u65b0\u5b83\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u6240\u4ee5\u6211\u4eec\u9700\u8981\u5199\u4e00\u4e2a\u811a\u672c\uff0c\u8ba9\u7eed\u671f\u6210\u529f\u540e\u81ea\u52a8\u590d\u5236\u5e76\u4e14\u91cd\u542f <code>hysteria<\/code>\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;root@localhost ~]# vim \/etc\/letsencrypt\/renewal-hooks\/deploy\/hysteria.sh\n\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\n#!\/bin\/bash\ncp -L \u8bc1\u4e66\u8def\u5f84 \/etc\/hysteria\/\u8bc1\u4e66\ncp -L \u8bc1\u4e66\u8def\u5f84 \/etc\/hysteria\/\u5bc6\u94a5\nchown hysteria:hysteria \/etc\/hysteria\/\u8bc1\u4e66 \/etc\/hysteria\/\u5bc6\u94a5\nchmod 600 \/etc\/hysteria\/\u5bc6\u94a5\nsystemctl restart hysteria-server\n\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u7ed9\u4e0b\u6267\u884c\u6743\u9650<\/strong><\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;root@localhost ~]# chmod +x \/etc\/letsencrypt\/renewal-hooks\/deploy\/hysteria.sh<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u597d\uff0c\u5230\u76ee\u524d\u4e3a\u6b62\uff0c\u5168\u90e8\u5b8c\u5de5\uff01\u261d\ufe0f\ud83e\udd13<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u68c0\u67e5\u670d\u52a1\u5668\u914d\u7f6e \u4e0b\u8f7d\u5b89\u88c5 Hysteria &hellip;<\/p>\n","protected":false},"author":1,"featured_media":154,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[],"class_list":["post-152","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-6"],"_links":{"self":[{"href":"https:\/\/xgz.app\/index.php?rest_route=\/wp\/v2\/posts\/152","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/xgz.app\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/xgz.app\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/xgz.app\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/xgz.app\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=152"}],"version-history":[{"count":1,"href":"https:\/\/xgz.app\/index.php?rest_route=\/wp\/v2\/posts\/152\/revisions"}],"predecessor-version":[{"id":155,"href":"https:\/\/xgz.app\/index.php?rest_route=\/wp\/v2\/posts\/152\/revisions\/155"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/xgz.app\/index.php?rest_route=\/wp\/v2\/media\/154"}],"wp:attachment":[{"href":"https:\/\/xgz.app\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=152"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/xgz.app\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=152"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/xgz.app\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=152"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}