{"id":54970,"date":"2025-02-18T11:51:46","date_gmt":"2025-02-18T03:51:46","guid":{"rendered":"https:\/\/fwq.ai\/blog\/54970\/"},"modified":"2025-02-18T11:51:46","modified_gmt":"2025-02-18T03:51:46","slug":"%e5%a6%82%e4%bd%95%e5%9c%a8caddy2%e4%b8%ad%e9%85%8d%e7%bd%ae%e5%92%8c%e4%bd%bf%e7%94%a8v2ray","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/54970\/","title":{"rendered":"\u5982\u4f55\u5728Caddy2\u4e2d\u914d\u7f6e\u548c\u4f7f\u7528V2Ray"},"content":{"rendered":"<h2>\u5f15\u8a00<\/h2>\n<p>\u5728\u5f53\u4eca\u7684\u7f51\u7edc\u73af\u5883\u4e2d\uff0c\u5f88\u591a\u7528\u6237\u9700\u8981\u501f\u52a9\u4ee3\u7406\u5de5\u5177\u6765\u8bbf\u95ee\u88ab\u9650\u5236\u7684\u7f51\u7ad9\u3002<em>Caddy2<\/em> \u662f\u4e00\u6b3e\u5f3a\u5927\u7684web\u670d\u52a1\u5668\uff0c\u800c <em>V2Ray<\/em> \u5219\u662f\u4e00\u4e2a\u529f\u80fd\u4e30\u5bcc\u7684\u7f51\u7edc\u4ee3\u7406\u5de5\u5177\u3002\u5c06\u4e8c\u8005\u7ed3\u5408\u4f7f\u7528\uff0c\u53ef\u4ee5\u6709\u6548\u63d0\u5347\u8bbf\u95ee\u901f\u5ea6\u548c\u5b89\u5168\u6027\u3002\u672c\u6587\u5c06\u4e3a\u5927\u5bb6\u8be6\u7ec6\u4ecb\u7ecd\u5982\u4f55\u5728 <em>Caddy2<\/em> \u4e2d\u914d\u7f6e <em>V2Ray<\/em>\uff0c\u4ee5\u5b9e\u73b0\u6700\u4f73\u7684\u4f7f\u7528\u4f53\u9a8c\u3002<\/p>\n<h2>\u4ec0\u4e48\u662fCaddy2\uff1f<\/h2>\n<p><em>Caddy2<\/em> \u662f\u4e00\u6b3e\u73b0\u4ee3\u5316\u7684web\u670d\u52a1\u5668\uff0c\u7279\u70b9\u5982\u4e0b\uff1a<\/p>\n<ul>\n<li><strong>\u7b80\u5355\u6613\u7528<\/strong>\uff1a\u901a\u8fc7\u7b80\u5355\u7684\u914d\u7f6e\u6587\u4ef6\u53ef\u4ee5\u5b8c\u6210\u590d\u6742\u7684\u4efb\u52a1\u3002<\/li>\n<li><strong>\u81ea\u52a8HTTPS<\/strong>\uff1a\u9ed8\u8ba4\u652f\u6301HTTPS\uff0c\u81ea\u52a8\u751f\u6210\u8bc1\u4e66\uff0c\u7701\u53bb\u4e86\u7e41\u7410\u7684\u914d\u7f6e\u3002<\/li>\n<li><strong>\u53ef\u6269\u5c55\u6027<\/strong>\uff1a\u901a\u8fc7\u63d2\u4ef6\u53ef\u4ee5\u589e\u52a0\u989d\u5916\u7684\u529f\u80fd\uff0c\u652f\u6301\u591a\u79cd\u534f\u8bae\u3002<\/li>\n<\/ul>\n<h2>\u4ec0\u4e48\u662fV2Ray\uff1f<\/h2>\n<p><em>V2Ray<\/em> \u662f\u4e00\u4e2a\u5f00\u6e90\u7684\u7f51\u7edc\u4ee3\u7406\u5de5\u5177\uff0c\u63d0\u4f9b\u4e86\u4ee5\u4e0b\u7279\u70b9\uff1a<\/p>\n<ul>\n<li><strong>\u591a\u79cd\u534f\u8bae\u652f\u6301<\/strong>\uff1a\u5305\u62ecVMess\u3001VLess\u3001Shadowsocks\u7b49\u3002<\/li>\n<li><strong>\u7075\u6d3b\u914d\u7f6e<\/strong>\uff1a\u53ef\u4ee5\u6839\u636e\u9700\u8981\u81ea\u7531\u914d\u7f6e\uff0c\u9002\u5e94\u4e0d\u540c\u7684\u7f51\u7edc\u73af\u5883\u3002<\/li>\n<li><strong>\u6570\u636e\u4f20\u8f93\u5b89\u5168<\/strong>\uff1a\u901a\u8fc7\u52a0\u5bc6\u548c\u4f2a\u88c5\uff0c\u63d0\u9ad8\u4e86\u6570\u636e\u7684\u5b89\u5168\u6027\u3002<\/li>\n<\/ul>\n<h2>Caddy2\u4e0eV2Ray\u7684\u7ed3\u5408<\/h2>\n<p>\u5c06 <em>Caddy2<\/em> \u548c <em>V2Ray<\/em> \u7ed3\u5408\u4f7f\u7528\uff0c\u53ef\u4ee5\u5b9e\u73b0\u66f4\u597d\u7684\u7f51\u7edc\u4ee3\u7406\u6548\u679c\u3002\u901a\u8fc7 <em>Caddy2<\/em> \u7684\u53cd\u5411\u4ee3\u7406\u529f\u80fd\uff0c\u53ef\u4ee5\u5c06 <em>V2Ray<\/em> \u670d\u52a1\u66b4\u9732\u5728\u7279\u5b9a\u7684\u7aef\u53e3\uff0c\u4fbf\u4e8e\u7ba1\u7406\u548c\u4f7f\u7528\u3002<\/p>\n<h2>Caddy2\u7684\u5b89\u88c5<\/h2>\n<p>\u5728\u5b89\u88c5 <em>Caddy2<\/em> \u4e4b\u524d\uff0c\u9700\u8981\u786e\u4fdd\u60a8\u7684\u7cfb\u7edf\u73af\u5883\u7b26\u5408\u8981\u6c42\u3002\u53ef\u4ee5\u5728\u5b98\u65b9\u6587\u6863\u4e2d\u67e5\u770b\u652f\u6301\u7684\u64cd\u4f5c\u7cfb\u7edf\u3002<\/p>\n<h3>\u5b89\u88c5\u6b65\u9aa4\uff1a<\/h3>\n<ol>\n<li>\n<p><strong>\u66f4\u65b0\u7cfb\u7edf<\/strong>\uff1a\u786e\u4fdd\u7cfb\u7edf\u662f\u6700\u65b0\u7684\u3002 bash sudo apt update &amp;&amp; sudo apt upgrade<\/p>\n<\/li>\n<li>\n<p><strong>\u4e0b\u8f7dCaddy2<\/strong>\uff1a\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u4e0b\u8f7d\u6700\u65b0\u7248\u672c\u3002 bash curl -s https:\/\/getcaddy.com | bash -s personal<\/p>\n<\/li>\n<li>\n<p><strong>\u9a8c\u8bc1\u5b89\u88c5<\/strong>\uff1a\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\u786e\u8ba4\u5b89\u88c5\u6210\u529f\u3002 bash caddy version<\/p>\n<\/li>\n<\/ol>\n<h2>V2Ray\u7684\u5b89\u88c5<\/h2>\n<p>\u63a5\u4e0b\u6765\uff0c\u9700\u8981\u5b89\u88c5 <em>V2Ray<\/em>\uff0c\u53ef\u901a\u8fc7\u5b98\u65b9\u63d0\u4f9b\u7684\u5b89\u88c5\u811a\u672c\u8fdb\u884c\u5feb\u901f\u5b89\u88c5\u3002<\/p>\n<h3>\u5b89\u88c5\u6b65\u9aa4\uff1a<\/h3>\n<ol>\n<li>\n<p><strong>\u4e0b\u8f7dV2Ray<\/strong>\uff1a\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u4e0b\u8f7d\u5e76\u5b89\u88c5\u3002 bash bash &lt;(curl -s -L https:\/\/git.io\/v2ray.sh)<\/p>\n<\/li>\n<li>\n<p><strong>\u914d\u7f6eV2Ray<\/strong>\uff1a\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u7f16\u8f91\u914d\u7f6e\u6587\u4ef6 <code>config.json<\/code>\u3002 bash sudo nano \/etc\/v2ray\/config.json<\/p>\n<\/li>\n<\/ol>\n<h2>\u914d\u7f6eCaddy2\u53cd\u5411\u4ee3\u7406V2Ray<\/h2>\n<p>\u5728 <em>Caddy2<\/em> \u4e2d\u914d\u7f6e <em>V2Ray<\/em> \u7684\u53cd\u5411\u4ee3\u7406\u975e\u5e38\u7b80\u5355\uff0c\u53ea\u9700\u4fee\u6539 Caddyfile \u6587\u4ef6\u3002<\/p>\n<h3>Caddyfile \u914d\u7f6e\u793a\u4f8b\uff1a<\/h3>\n<p>caddyfile example.com { reverse_proxy localhost:10086 # V2Ray \u7684\u9ed8\u8ba4\u7aef\u53e3}<\/p>\n<h3>\u542f\u52a8Caddy2\uff1a<\/h3>\n<p>\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u542f\u52a8 <em>Caddy2<\/em> \u4ee5\u4f7f\u914d\u7f6e\u751f\u6548\u3002 bash caddy run<\/p>\n<h2>\u5e38\u89c1\u95ee\u9898\u89e3\u7b54 (FAQ)<\/h2>\n<h3>Caddy2\u548cV2Ray\u7684\u7ed3\u5408\u80fd\u63d0\u9ad8\u5b89\u5168\u6027\u5417\uff1f<\/h3>\n<p>\u662f\u7684\uff0c\u5c06 <em>Caddy2<\/em> \u548c <em>V2Ray<\/em> \u7ed3\u5408\u4f7f\u7528\uff0c\u53ef\u4ee5\u6709\u6548\u5730\u63d0\u9ad8\u6570\u636e\u4f20\u8f93\u7684\u5b89\u5168\u6027\uff0c\u7279\u522b\u662f\u5728\u516c\u5171\u7f51\u7edc\u73af\u5883\u4e2d\u3002<\/p>\n<h3>\u5982\u4f55\u68c0\u67e5Caddy2\u548cV2Ray\u662f\u5426\u6b63\u5e38\u5de5\u4f5c\uff1f<\/h3>\n<p>\u53ef\u4ee5\u901a\u8fc7\u8bbf\u95ee\u914d\u7f6e\u7684\u57df\u540d\u6765\u68c0\u67e5\u662f\u5426\u53ef\u4ee5\u6210\u529f\u8fde\u63a5\u3002\u5982\u679c\u65e0\u6cd5\u8bbf\u95ee\uff0c\u53ef\u4ee5\u67e5\u770b <em>Caddy2<\/em> \u548c <em>V2Ray<\/em> \u7684\u65e5\u5fd7\u6587\u4ef6\uff0c\u4ee5\u67e5\u627e\u9519\u8bef\u4fe1\u606f\u3002<\/p>\n<h3>Caddy2\u9700\u8981\u7279\u6b8a\u7684\u7cfb\u7edf\u6743\u9650\u5417\uff1f<\/h3>\n<p>\u5728\u5927\u591a\u6570\u60c5\u51b5\u4e0b\uff0c<em>Caddy2<\/em> \u9700\u8981 root \u6743\u9650\u624d\u80fd\u76d1\u542c 80 \u548c 443 \u7aef\u53e3\u3002\u5efa\u8bae\u4f7f\u7528 <code>systemd<\/code> \u6216 <code>docker<\/code> \u6765\u7ba1\u7406\u670d\u52a1\u3002<\/p>\n<h3>V2Ray\u7684\u914d\u7f6e\u6587\u4ef6\u5e94\u8be5\u5982\u4f55\u8bbe\u7f6e\uff1f<\/h3>\n<p><em>V2Ray<\/em> \u7684\u914d\u7f6e\u6587\u4ef6 <code>config.json<\/code> \u4e2d\uff0c\u4e3b\u8981\u5305\u542b <em>inbounds<\/em> \u548c <em>outbounds<\/em> \u7684\u914d\u7f6e\u3002\u9700\u8981\u6839\u636e\u81ea\u5df1\u7684\u9700\u6c42\u8bbe\u7f6e\u76f8\u5e94\u7684\u53c2\u6570\u3002<\/p>\n<h2>\u7ed3\u8bba<\/h2>\n<p>\u901a\u8fc7\u672c\u6587\u7684\u4ecb\u7ecd\uff0c\u76f8\u4fe1\u5927\u5bb6\u5bf9\u5982\u4f55\u5728 <em>Caddy2<\/em> \u4e2d\u914d\u7f6e\u548c\u4f7f\u7528 <em>V2Ray<\/em> \u6709\u4e86\u66f4\u52a0\u6df1\u5165\u7684\u4e86\u89e3\u3002\u5408\u7406\u5229\u7528\u8fd9\u4e24\u4e2a\u5de5\u5177\uff0c\u53ef\u4ee5\u4e3a\u60a8\u7684\u7f51\u7edc\u8bbf\u95ee\u5e26\u6765\u66f4\u597d\u7684\u4f53\u9a8c\u3002\u5982\u679c\u60a8\u5728\u4f7f\u7528\u4e2d\u9047\u5230\u95ee\u9898\uff0c\u53ef\u4ee5\u968f\u65f6\u67e5\u9605\u76f8\u5173\u6587\u6863\u6216\u8bba\u575b\u5bfb\u6c42\u5e2e\u52a9\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5f15\u8a00 \u5728\u5f53\u4eca\u7684\u7f51\u7edc\u73af\u5883\u4e2d\uff0c\u5f88\u591a\u7528\u6237\u9700\u8981\u501f\u52a9\u4ee3\u7406\u5de5\u5177\u6765\u8bbf\u95ee\u88ab\u9650\u5236\u7684\u7f51\u7ad9\u3002Caddy2 \u662f\u4e00\u6b3e\u5f3a\u5927\u7684web\u670d\u52a1\u5668\uff0c\u800c V2Ray \u5219\u662f\u4e00\u4e2a\u529f\u80fd\u4e30\u5bcc\u7684\u7f51\u7edc\u4ee3\u7406\u5de5\u5177\u3002\u5c06\u4e8c\u8005\u7ed3\u5408\u4f7f\u7528\uff0c\u53ef\u4ee5\u6709\u6548\u63d0\u5347\u8bbf\u95ee\u901f\u5ea6\u548c\u5b89\u5168\u6027\u3002\u672c\u6587\u5c06\u4e3a\u5927\u5bb6\u8be6\u7ec6\u4ecb\u7ecd\u5982\u4f55\u5728 Caddy2 \u4e2d\u914d\u7f6e V2Ray\uff0c\u4ee5\u5b9e\u73b0\u6700\u4f73\u7684\u4f7f\u7528\u4f53\u9a8c\u3002 \u4ec0\u4e48\u662fCaddy2\uff1f Caddy2 \u662f\u4e00\u6b3e\u73b0\u4ee3\u5316\u7684web\u670d\u52a1\u5668\uff0c\u7279\u70b9\u5982\u4e0b\uff1a \u7b80\u5355\u6613\u7528\uff1a\u901a\u8fc7\u7b80\u5355\u7684\u914d\u7f6e\u6587\u4ef6\u53ef\u4ee5\u5b8c\u6210\u590d\u6742\u7684\u4efb\u52a1\u3002 \u81ea\u52a8HTTPS\uff1a\u9ed8\u8ba4\u652f\u6301HTTPS\uff0c\u81ea\u52a8\u751f\u6210\u8bc1\u4e66\uff0c\u7701\u53bb\u4e86\u7e41\u7410\u7684\u914d\u7f6e\u3002 \u53ef\u6269\u5c55\u6027\uff1a\u901a\u8fc7\u63d2\u4ef6\u53ef\u4ee5\u589e\u52a0\u989d\u5916\u7684\u529f\u80fd\uff0c\u652f\u6301\u591a\u79cd\u534f\u8bae\u3002 \u4ec0\u4e48\u662fV2Ray\uff1f V2Ray \u662f\u4e00\u4e2a\u5f00\u6e90\u7684\u7f51\u7edc\u4ee3\u7406\u5de5\u5177\uff0c\u63d0\u4f9b\u4e86\u4ee5\u4e0b\u7279\u70b9\uff1a \u591a\u79cd\u534f\u8bae\u652f\u6301\uff1a\u5305\u62ecVMess\u3001VLess\u3001Shadowsocks\u7b49\u3002 \u7075\u6d3b\u914d\u7f6e\uff1a\u53ef\u4ee5\u6839\u636e\u9700\u8981\u81ea\u7531\u914d\u7f6e\uff0c\u9002\u5e94\u4e0d\u540c\u7684\u7f51\u7edc\u73af\u5883\u3002 \u6570\u636e\u4f20\u8f93\u5b89\u5168\uff1a\u901a\u8fc7\u52a0\u5bc6\u548c\u4f2a\u88c5\uff0c\u63d0\u9ad8\u4e86\u6570\u636e\u7684\u5b89\u5168\u6027\u3002 Caddy2\u4e0eV2Ray\u7684\u7ed3\u5408 \u5c06 Caddy2 \u548c V2Ray \u7ed3\u5408\u4f7f\u7528\uff0c\u53ef\u4ee5\u5b9e\u73b0\u66f4\u597d\u7684\u7f51\u7edc\u4ee3\u7406\u6548\u679c\u3002\u901a\u8fc7 Caddy2 \u7684\u53cd\u5411\u4ee3\u7406\u529f\u80fd\uff0c\u53ef\u4ee5\u5c06 V2Ray \u670d\u52a1\u66b4\u9732\u5728\u7279\u5b9a\u7684\u7aef\u53e3\uff0c\u4fbf\u4e8e\u7ba1\u7406\u548c\u4f7f\u7528\u3002 Caddy2\u7684\u5b89\u88c5 \u5728\u5b89\u88c5 Caddy2 \u4e4b\u524d\uff0c\u9700\u8981\u786e\u4fdd\u60a8\u7684\u7cfb\u7edf\u73af\u5883\u7b26\u5408\u8981\u6c42\u3002\u53ef\u4ee5\u5728\u5b98\u65b9\u6587\u6863\u4e2d\u67e5\u770b\u652f\u6301\u7684\u64cd\u4f5c\u7cfb\u7edf\u3002 \u5b89\u88c5\u6b65\u9aa4\uff1a \u66f4\u65b0\u7cfb\u7edf\uff1a\u786e\u4fdd\u7cfb\u7edf\u662f\u6700\u65b0\u7684\u3002 bash sudo apt update &amp;&amp; sudo apt upgrade \u4e0b\u8f7dCaddy2\uff1a\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u4e0b\u8f7d\u6700\u65b0\u7248\u672c\u3002 bash curl -s https:\/\/getcaddy.com | bash -s personal \u9a8c\u8bc1\u5b89\u88c5\uff1a\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\u786e\u8ba4\u5b89\u88c5\u6210\u529f\u3002 bash [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[21],"tags":[],"class_list":["post-54970","post","type-post","status-publish","format-standard","hentry","category-vpn"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/54970","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=54970"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/54970\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=54970"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=54970"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=54970"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}