{"id":1415,"date":"2026-10-06T09:39:09","date_gmt":"2026-10-06T01:39:09","guid":{"rendered":"https:\/\/www.suannai.link\/blog\/xray-%e5%ae%a2%e6%88%b7%e7%ab%af%e6%8a%a5%e9%94%99%e6%97%a0%e6%b3%95%e8%bf%9e%e6%8e%a5%e6%97%b6%e7%9a%84%e6%8e%92%e6%9f%a5%e4%b8%8e%e4%bf%ae%e5%a4%8d\/"},"modified":"2026-10-06T09:39:09","modified_gmt":"2026-10-06T01:39:09","slug":"xray-%e5%ae%a2%e6%88%b7%e7%ab%af%e6%8a%a5%e9%94%99%e6%97%a0%e6%b3%95%e8%bf%9e%e6%8e%a5%e6%97%b6%e7%9a%84%e6%8e%92%e6%9f%a5%e4%b8%8e%e4%bf%ae%e5%a4%8d","status":"publish","type":"post","link":"https:\/\/www.suannai.link\/blog\/xray-%e5%ae%a2%e6%88%b7%e7%ab%af%e6%8a%a5%e9%94%99%e6%97%a0%e6%b3%95%e8%bf%9e%e6%8e%a5%e6%97%b6%e7%9a%84%e6%8e%92%e6%9f%a5%e4%b8%8e%e4%bf%ae%e5%a4%8d\/","title":{"rendered":"Xray \u5ba2\u6237\u7aef\u62a5\u9519\u65e0\u6cd5\u8fde\u63a5\u65f6\u7684\u6392\u67e5\u4e0e\u4fee\u590d"},"content":{"rendered":"<p>\u5f53 Xray \u5ba2\u6237\u7aef\uff08\u5982 Xray-core\u3001XrayR\u3001Xray-UI \u7b49\uff09\u7a81\u7136\u65e0\u6cd5\u8fde\u63a5\u6216\u62a5\u9519\u65f6\uff0c\u901a\u5e38\u4e0d\u662f\u8f6f\u4ef6\u672c\u8eab\u635f\u574f\uff0c\u800c\u662f<a href=\"https:\/\/www.suannai.link\/blog\/xray-%e9%85%8d%e7%bd%ae%e4%b8%8e%e4%bd%bf%e7%94%a8%e5%85%a8%e6%b5%81%e7%a8%8b%ef%bc%9a%e4%bb%8e%e5%8e%9f%e7%90%86%e5%88%b0%e5%ae%a2%e6%88%b7%e7%ab%af%e5%ae%9e%e6%93%8d\/\" target=\"_blank\" rel=\"noopener\">\u914d\u7f6e\u3001\u7f51\u7edc\u73af\u5883\u6216\u4f9d\u8d56\u670d\u52a1<\/a>\u51fa\u73b0\u4e86\u5f02\u5e38\u3002\u6392\u67e5\u7684\u6838\u5fc3\u903b\u8f91\u9075\u5faa\u201c\u4ece\u672c\u5730\u5230\u8fdc\u7a0b\u3001\u4ece\u914d\u7f6e\u5230\u7f51\u7edc\u201d\u7684\u987a\u5e8f\u3002<\/p>\n<p>\u672c\u6587\u5c06\u9488\u5bf9 <a href=\"https:\/\/www.suannai.link\/blog\/xray%e5%b7%a5%e5%85%b7%e8%bf%9e%e6%8e%a5%e5%a4%b1%e8%b4%a5%e6%80%8e%e4%b9%88%e5%8a%9e%ef%bc%9a%e4%bb%8e%e9%85%8d%e7%bd%ae%e5%88%b0%e7%8e%af%e5%a2%83%e7%9a%84%e5%ae%8c%e6%95%b4%e6%8e%92%e6%9f%a5\/\" target=\"_blank\" rel=\"noopener\">Xray \u5de5\u5177\u65e0\u6cd5\u4f7f\u7528<\/a>\u7684\u5e38\u89c1\u6545\u969c\uff0c\u63d0\u4f9b\u4e00\u5957\u6807\u51c6\u5316\u7684\u6392\u67e5\u6d41\u7a0b\uff0c\u5e2e\u52a9\u4f60\u5feb\u901f\u5b9a\u4f4d\u95ee\u9898\u6839\u6e90\u5e76\u6062\u590d\u8fde\u63a5\u3002<\/p>\n<h2>1. \u786e\u8ba4\u9519\u8bef\u7c7b\u578b\u4e0e\u65e5\u5fd7\u4fe1\u606f<\/h2>\n<p>\u5728\u5c1d\u8bd5\u4efb\u4f55\u4fee\u590d\u64cd\u4f5c\u524d\uff0c\u9996\u5148\u5fc5\u987b\u660e\u786e\u5177\u4f53\u7684\u62a5\u9519\u73b0\u8c61\u3002Xray \u76f8\u5173\u7684\u5de5\u5177\u62a5\u9519\u901a\u5e38\u5206\u4e3a\u4e24\u7c7b\uff1a\u5ba2\u6237\u7aef\uff08Client\uff09\u62a5\u9519\u548c\u670d\u52a1\u5668\u7aef\uff08Server\uff09\u62a5\u9519\u3002<\/p>\n<p>* <strong>\u5ba2\u6237\u7aef\u8868\u73b0<\/strong>\uff1a\u901a\u5e38\u663e\u793a\u201c\u8fde\u63a5\u8d85\u65f6\u201d\u3001\u201c\u63e1\u624b\u5931\u8d25\u201d\u3001\u201c\u8bc1\u4e66\u9519\u8bef\u201d\u6216\u201c\u534f\u8bae\u4e0d\u652f\u6301\u201d\u3002\u8fd9\u901a\u5e38\u610f\u5473\u7740\u6570\u636e\u5305\u5df2\u7ecf\u53d1\u51fa\uff0c\u4f46\u5bf9\u65b9\u6ca1\u6709\u6b63\u786e\u56de\u5e94\u3002<br \/>* <strong>\u670d\u52a1\u5668\u7aef\u8868\u73b0<\/strong>\uff1a\u901a\u5e38\u663e\u793a\u201c\u670d\u52a1\u672a\u542f\u52a8\u201d\u3001\u201c\u7aef\u53e3\u5360\u7528\u201d\u3001\u201c\u914d\u7f6e\u8bed\u6cd5\u9519\u8bef\u201d\u6216\u201c\u4f9d\u8d56\u5e93\u7f3a\u5931\u201d\u3002\u8fd9\u901a\u5e38\u610f\u5473\u7740\u670d\u52a1\u672c\u8eab\u6ca1\u6709\u6b63\u5e38\u8fd0\u884c\u3002<\/p>\n<p><strong>\u64cd\u4f5c\u6b65\u9aa4\uff1a<\/strong><br \/>\u2022 <strong>\u67e5\u770b\u65e5\u5fd7<\/strong>\uff1a\u8fd9\u662f\u6700\u76f4\u63a5\u7684\u8bca\u65ad\u624b\u6bb5\u3002<br \/> * \u5982\u679c\u662f\u684c\u9762\u7aef\u8f6f\u4ef6\uff0c\u67e5\u770b\u8f6f\u4ef6\u5185\u90e8\u7684\u201c\u65e5\u5fd7\u201d\u6216\u201c\u8c03\u8bd5\u201d\u9762\u677f\u3002<br \/> * \u5982\u679c\u662f\u547d\u4ee4\u884c\u6216 Docker \u90e8\u7f72\uff0c\u67e5\u770b `stdout` \u6216 `stderr` \u8f93\u51fa\u3002<br \/> * \u5982\u679c\u662f systemd \u670d\u52a1\uff0c\u4f7f\u7528 `journalctl -u xray -f` \u5b9e\u65f6\u67e5\u770b\u3002<br \/>\u2022 <strong>\u8bb0\u5f55\u5173\u952e\u9519\u8bef\u7801<\/strong>\uff1a\u4f8b\u5982 `code: 13` \u901a\u5e38\u8868\u793a\u5185\u90e8\u9519\u8bef\uff0c`code: 4` \u8868\u793a\u65e0\u6548\u914d\u7f6e\uff0c`timeout` \u8868\u793a\u7f51\u7edc\u4e0d\u901a\u3002<\/p>\n<p><strong>\u539f\u56e0\u5206\u6790\uff1a<\/strong><br \/>\u65e5\u5fd7\u662f Xray \u5f15\u64ce\u7684\u201c\u9ed1\u5323\u5b50\u201d\u3002\u8df3\u8fc7\u65e5\u5fd7\u76f4\u63a5\u91cd\u542f\u670d\u52a1\u6216\u4fee\u6539\u914d\u7f6e\uff0c\u5f80\u5f80\u65e0\u6cd5\u89e3\u51b3\u6839\u672c\u95ee\u9898\uff0c\u751a\u81f3\u53ef\u80fd\u63a9\u76d6\u771f\u6b63\u7684\u9519\u8bef\u539f\u56e0\uff08\u5982\u6743\u9650\u4e0d\u8db3\u6216\u7aef\u53e3\u51b2\u7a81\uff09\u3002<\/p>\n\n<h2>2. \u68c0\u67e5\u914d\u7f6e\u6587\u4ef6\u8bed\u6cd5\u4e0e\u683c\u5f0f<\/h2>\n<p>Xray \u5bf9 JSON \u914d\u7f6e\u6587\u4ef6\u7684\u683c\u5f0f\u8981\u6c42\u975e\u5e38\u4e25\u683c\u3002\u5373\u4f7f\u662f\u4e00\u4e2a\u591a\u4f59\u7684\u9017\u53f7\u3001\u7f3a\u5931\u7684\u5927\u62ec\u53f7\u6216\u9519\u8bef\u7684\u952e\u540d\uff0c\u90fd\u4f1a\u5bfc\u81f4\u670d\u52a1\u542f\u52a8\u5931\u8d25\u6216\u8fd0\u884c\u5f02\u5e38\u3002<\/p>\n<p><strong>\u5e38\u89c1\u914d\u7f6e\u9519\u8bef\uff1a<\/strong><br \/>* <strong>JSON \u8bed\u6cd5\u9519\u8bef<\/strong>\uff1a\u7f3a\u5c11\u9017\u53f7\u3001\u5f15\u53f7\u4e0d\u5339\u914d\u3001\u5c3e\u968f\u9017\u53f7\u3002<br \/>* <strong>\u534f\u8bae\u4e0d\u5339\u914d<\/strong>\uff1a\u914d\u7f6e\u6587\u4ef6\u4e2d\u7684\u534f\u8bae\u7c7b\u578b\uff08\u5982 vmess, vless, trojan\uff09\u4e0e\u5ba2\u6237\u7aef\u6216\u670d\u52a1\u5668\u7aef\u5b9e\u9645\u652f\u6301\u7684\u7248\u672c\u4e0d\u4e00\u81f4\u3002<br \/>* <strong>ID\/Key \u9519\u8bef<\/strong>\uff1aUUID \u683c\u5f0f\u9519\u8bef\u3001\u5bc6\u94a5\u957f\u5ea6\u4e0d\u5bf9\u6216\u5b8c\u5168\u9519\u8bef\u3002<\/p>\n<p><strong>\u6392\u67e5\u6b65\u9aa4\uff1a<\/strong><br \/>\u2022 <strong>\u4f7f\u7528\u5728\u7ebf\u9a8c\u8bc1\u5de5\u5177<\/strong>\uff1a\u5c06\u4f60\u7684\u914d\u7f6e\u6587\u4ef6\u5185\u5bb9\u590d\u5236\u5230\u5728\u7ebf JSON \u9a8c\u8bc1\u5668\u4e2d\uff0c\u68c0\u67e5\u662f\u5426\u6709\u8bed\u6cd5\u9519\u8bef\u3002<br \/>\u2022 <strong>\u4f7f\u7528 Xray \u5b98\u65b9\u9a8c\u8bc1\u547d\u4ee4<\/strong>\uff1a<br \/> \u5982\u679c\u62e5\u6709\u670d\u52a1\u5668\u8bbf\u95ee\u6743\u9650\uff0c\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\u68c0\u67e5\u914d\u7f6e\u6709\u6548\u6027\uff1a<br \/> &#8220;`bash<br \/> xray x2ray -format=json -config \/path\/to\/your\/config.json<br \/> &#8220;`<br \/> \u5982\u679c\u8f93\u51fa\u663e\u793a `OK`\uff0c\u5219\u914d\u7f6e\u8bed\u6cd5\u65e0\u8bef\uff1b\u5982\u679c\u62a5\u9519\uff0c\u8bf7\u6839\u636e\u63d0\u793a\u4fee\u6539\u5bf9\u5e94\u884c\u3002<br \/>\u2022 <strong>\u68c0\u67e5\u5b57\u6bb5\u7c7b\u578b<\/strong>\uff1a\u786e\u4fdd `port` \u662f\u6570\u5b57\u800c\u975e\u5b57\u7b26\u4e32\uff0c`id` \u662f\u5b57\u7b26\u4e32\uff0c`security` \u662f\u5b57\u7b26\u4e32\u7b49\u3002<\/p>\n<p><strong>\u539f\u56e0\u5206\u6790\uff1a<\/strong><br \/>Xray \u5f15\u64ce\u5728\u542f\u52a8\u65f6\u4f1a\u89e3\u6790 JSON \u6587\u4ef6\u3002\u5982\u679c\u683c\u5f0f\u9519\u8bef\uff0c\u670d\u52a1\u6839\u672c\u65e0\u6cd5\u542f\u52a8\uff0c\u81ea\u7136\u65e0\u6cd5\u63d0\u4f9b\u4efb\u4f55\u8fde\u63a5\u670d\u52a1\u3002\u8fd9\u662f\u6700\u5e38\u89c1\u4e14\u6700\u5bb9\u6613\u4fee\u590d\u7684\u6545\u969c\u70b9\u3002<\/p>\n<h2>3. \u9a8c\u8bc1\u7f51\u7edc\u8fde\u901a\u6027\u4e0e\u7aef\u53e3\u72b6\u6001<\/h2>\n<p>\u5982\u679c\u914d\u7f6e\u65e0\u8bef\uff0c\u95ee\u9898\u53ef\u80fd\u51fa\u5728\u7f51\u7edc\u5c42\u9762\u3002Xray \u4f9d\u8d56 TCP \u6216 UDP \u534f\u8bae\u8fdb\u884c\u901a\u4fe1\uff0c\u4efb\u4f55\u4e2d\u95f4\u7684\u7f51\u7edc\u963b\u65ad\u90fd\u4f1a\u5bfc\u81f4\u8fde\u63a5\u5931\u8d25\u3002<\/p>\n<p><strong>\u6392\u67e5\u6b65\u9aa4\uff1a<\/strong><br \/>\u2022 <strong>\u68c0\u67e5\u7aef\u53e3\u76d1\u542c\u72b6\u6001<\/strong>\uff1a<br \/> \u5728\u670d\u52a1\u5668\u7aef\u8fd0\u884c\uff1a<br \/> &#8220;`bash<br \/> netstat -tlnp | grep <\u4f60\u7684\u7aef\u53e3\u53f7><br \/> &#8220;`<br \/> \u5982\u679c\u6ca1\u6709\u4efb\u4f55\u8f93\u51fa\uff0c\u8bf4\u660e Xray \u670d\u52a1\u6ca1\u6709\u6210\u529f\u76d1\u542c\u8be5\u7aef\u53e3\uff0c\u9700\u8fd4\u56de\u68c0\u67e5\u670d\u52a1\u72b6\u6001\u3002<br \/>\u2022 <strong>\u6d4b\u8bd5\u672c\u5730\u56de\u73af<\/strong>\uff1a<br \/> \u5728\u670d\u52a1\u5668\u7aef\u8fd0\u884c\uff1a<br \/> &#8220;`bash<br \/> telnet 127.0.0.1 <\u7aef\u53e3\u53f7><br \/> &#8220;`<br \/> \u5982\u679c\u8fde\u63a5\u6210\u529f\uff0c\u8bf4\u660e\u670d\u52a1\u5728\u672c\u5730\u662f\u6d3b\u7684\uff0c\u95ee\u9898\u51fa\u5728\u5916\u90e8\u7f51\u7edc\u3002<br \/>\u2022 <strong>\u6d4b\u8bd5\u5916\u90e8\u8fde\u901a\u6027<\/strong>\uff1a<br \/> \u4ece\u4f60\u7684\u5ba2\u6237\u7aef\u6240\u5728\u7f51\u7edc\uff0c\u4f7f\u7528 `telnet <\u670d\u52a1\u5668IP> <\u7aef\u53e3\u53f7>` \u6216 `nc -vz <\u670d\u52a1\u5668IP> <\u7aef\u53e3\u53f7>` \u6d4b\u8bd5\u3002<br \/> * \u5982\u679c\u8d85\u65f6\uff1a\u9632\u706b\u5899\u3001\u5b89\u5168\u7ec4\u6216 ISP \u62e6\u622a\u3002<br \/> * \u5982\u679c\u62d2\u7edd\u8fde\u63a5\uff1a\u7aef\u53e3\u672a\u5f00\u653e\u6216\u670d\u52a1\u672a\u542f\u52a8\u3002<br \/>\u2022 <strong>\u68c0\u67e5\u9632\u706b\u5899\u4e0e\u5b89\u5168\u7ec4<\/strong>\uff1a<br \/> * <strong>\u4e91\u670d\u52a1\u5668<\/strong>\uff1a\u767b\u5f55\u4e91\u63a7\u5236\u53f0\uff0c\u786e\u8ba4\u5b89\u5168\u7ec4\u5df2\u653e\u884c\u5bf9\u5e94\u7aef\u53e3\uff08TCP\/UDP\uff09\u3002<br \/> * <strong>\u672c\u5730\u670d\u52a1\u5668<\/strong>\uff1a\u68c0\u67e5 `iptables`\u3001`firewalld` \u6216 `ufw` \u89c4\u5219\u3002<\/p>\n<p><strong>\u539f\u56e0\u5206\u6790\uff1a<\/strong><br \/>\u73b0\u4ee3\u7f51\u7edc\u73af\u5883\u590d\u6742\uff0c\u4e91\u670d\u52a1\u5546\u9ed8\u8ba4\u5b89\u5168\u7ec4\u901a\u5e38\u53ea\u5f00\u653e 22\u300180\u3001443 \u7b49\u7aef\u53e3\u3002\u5982\u679c Xray \u8fd0\u884c\u5728\u975e\u6807\u51c6\u7aef\u53e3\uff08\u5982 10800\u300120000 \u7b49\uff09\uff0c\u5fc5\u987b\u624b\u52a8\u653e\u884c\uff0c\u5426\u5219\u6570\u636e\u5305\u4f1a\u88ab\u4e22\u5f03\u3002<\/p>\n<h2>4. \u68c0\u67e5\u534f\u8bae\u7248\u672c\u4e0e\u517c\u5bb9\u6027<\/h2>\n<p>Xray \u9879\u76ee\u8fed\u4ee3\u8fc5\u901f\uff0c\u534f\u8bae\u7248\u672c\uff08\u5982 VMess AEAD\u3001VLESS\u3001Trojan-Go\uff09\u5728\u4e0d\u540c\u7248\u672c\u95f4\u53ef\u80fd\u5b58\u5728\u517c\u5bb9\u6027\u95ee\u9898\u3002<\/p>\n<p><strong>\u5e38\u89c1\u95ee\u9898\uff1a<\/strong><br \/>* <strong>\u5ba2\u6237\u7aef\u4e0e\u670d\u52a1\u7aef\u7248\u672c\u5dee\u5f02\u8fc7\u5927<\/strong>\uff1a\u65e7\u7248\u5ba2\u6237\u7aef\u8fde\u63a5\u65b0\u7248\u670d\u52a1\u7aef\uff0c\u6216\u53cd\u4e4b\uff0c\u53ef\u80fd\u5bfc\u81f4\u63e1\u624b\u5931\u8d25\u3002<br \/>* <strong>\u52a0\u5bc6\u65b9\u5f0f\u4e0d\u5339\u914d<\/strong>\uff1a\u5982\u670d\u52a1\u7aef\u8981\u6c42 `chacha20-poly1305`\uff0c\u800c\u5ba2\u6237\u7aef\u914d\u7f6e\u4e3a `aes-128-gcm`\u3002<br \/>* <strong>TLS\/SSL \u914d\u7f6e\u9519\u8bef<\/strong>\uff1a\u5982\u679c\u4f7f\u7528\u4e86 HTTPS \u4f2a\u88c5\uff0c\u8bc1\u4e66\u8def\u5f84\u9519\u8bef\u6216\u8bc1\u4e66\u8fc7\u671f\u4f1a\u5bfc\u81f4\u8fde\u63a5\u4e2d\u65ad\u3002<\/p>\n<p><strong>\u6392\u67e5\u6b65\u9aa4\uff1a<\/strong><br \/>\u2022 <strong>\u6838\u5bf9\u534f\u8bae\u7ec6\u8282<\/strong>\uff1a\u786e\u4fdd\u5ba2\u6237\u7aef\u7684 `alterId`\uff08\u5982\u679c\u4ecd\u5728\u4f7f\u7528 VMess\uff09\u3001`security`\u3001`type` \u4e0e\u670d\u52a1\u7aef\u5b8c\u5168\u4e00\u81f4\u3002<br \/>\u2022 <strong>\u68c0\u67e5\u8bc1\u4e66\u6709\u6548\u6027<\/strong>\uff1a<br \/> \u5982\u679c\u4f7f\u7528\u4e86 HTTPS\uff0c\u68c0\u67e5\u8bc1\u4e66\u662f\u5426\u8fc7\u671f\u3002\u53ef\u4ee5\u4f7f\u7528 `openssl s_client` \u547d\u4ee4\u6d4b\u8bd5\uff1a<br \/> &#8220;`bash<br \/> openssl s_client -connect <\u57df\u540d\u6216IP>:<\u7aef\u53e3> -servername <\u57df\u540d><br \/> &#8220;`<br \/> \u67e5\u770b\u8f93\u51fa\u4e2d\u7684 `Verify return code` \u662f\u5426\u4e3a 0\u3002<br \/>\u2022 <strong>\u66f4\u65b0\u5ba2\u6237\u7aef\/\u670d\u52a1\u7aef<\/strong>\uff1a\u786e\u4fdd\u4e24\u7aef\u90fd\u4f7f\u7528\u8f83\u65b0\u7684\u7a33\u5b9a\u7248\u672c\uff0c\u4ee5\u907f\u514d\u5df2\u77e5\u7684\u534f\u8bae\u517c\u5bb9 Bug\u3002<\/p>\n<p><strong>\u539f\u56e0\u5206\u6790\uff1a<\/strong><br \/>\u7f51\u7edc\u534f\u8bae\u662f\u53cc\u5411\u7684\u3002\u5982\u679c\u4e00\u7aef\u5347\u7ea7\u4e86\u52a0\u5bc6\u7b97\u6cd5\u6216\u63e1\u624b\u6d41\u7a0b\uff0c\u800c\u53e6\u4e00\u7aef\u672a\u540c\u6b65\uff0c\u53cc\u65b9\u5c31\u65e0\u6cd5\u7406\u89e3\u5f7c\u6b64\u7684\u6570\u636e\uff0c\u8868\u73b0\u4e3a\u201c\u8fde\u63a5\u88ab\u91cd\u7f6e\u201d\u6216\u201c\u534f\u8bae\u9519\u8bef\u201d\u3002<\/p>\n<h2>5. \u68c0\u67e5\u7cfb\u7edf\u8d44\u6e90\u4e0e\u4f9d\u8d56\u5e93<\/h2>\n<p>Xray \u867d\u7136\u8f7b\u91cf\uff0c\u4f46\u4ecd\u4f9d\u8d56\u64cd\u4f5c\u7cfb\u7edf\u7684\u57fa\u7840\u5e93\u3002\u5982\u679c\u7cfb\u7edf\u8d44\u6e90\u8017\u5c3d\u6216\u4f9d\u8d56\u5e93\u7f3a\u5931\uff0c\u670d\u52a1\u4f1a\u5d29\u6e83\u6216\u65e0\u6cd5\u542f\u52a8\u3002<\/p>\n<p><strong>\u6392\u67e5\u6b65\u9aa4\uff1a<\/strong><br \/>\u2022 <strong>\u68c0\u67e5\u5185\u5b58\u4e0e CPU<\/strong>\uff1a<br \/> \u4f7f\u7528 `top` \u6216 `htop` \u67e5\u770b\u7cfb\u7edf\u8d1f\u8f7d\u3002\u5982\u679c\u5185\u5b58\u4e0d\u8db3\uff0cXray \u8fdb\u7a0b\u53ef\u80fd\u88ab OOM Killer\uff08\u5185\u5b58\u6ea2\u51fa\u7ec8\u6b62\u5668\uff09\u6740\u6b7b\u3002<br \/>\u2022 <strong>\u68c0\u67e5\u6587\u4ef6\u63cf\u8ff0\u7b26\u9650\u5236<\/strong>\uff1a<br \/> \u9ad8\u5e76\u53d1\u573a\u666f\u4e0b\uff0c\u6587\u4ef6\u63cf\u8ff0\u7b26\uff08FD\uff09\u8017\u5c3d\u4f1a\u5bfc\u81f4\u65b0\u8fde\u63a5\u65e0\u6cd5\u5efa\u7acb\u3002<br \/> \u68c0\u67e5 `ulimit -n` \u7684\u503c\uff0c\u5efa\u8bae\u8bbe\u7f6e\u4e3a `65535` \u6216\u66f4\u9ad8\u3002<br \/> \u4fee\u6539 `\/etc\/security\/limits.conf` \u6587\u4ef6\uff1a<br \/> &#8220;`<br \/> * soft nofile 65535<br \/> * hard nofile 65535<br \/> &#8220;`<br \/>\u2022 <strong>\u68c0\u67e5\u4f9d\u8d56\u5e93<\/strong>\uff1a<br \/> \u786e\u4fdd\u7cfb\u7edf\u5b89\u88c5\u4e86\u5fc5\u8981\u7684\u5e93\u6587\u4ef6\uff08\u5982 `libssl`\u3001`libc` \u7b49\uff09\u3002\u5982\u679c\u662f\u5728\u65b0\u7cfb\u7edf\u4e0a\u90e8\u7f72\uff0c\u53ef\u80fd\u9700\u8981\u66f4\u65b0 `apt` \u6216 `yum` \u7f13\u5b58\u3002<\/p>\n<p><strong>\u539f\u56e0\u5206\u6790\uff1a<\/strong><br \/>\u64cd\u4f5c\u7cfb\u7edf\u5c42\u9762\u7684\u9650\u5236\u5f80\u5f80\u88ab\u5ffd\u7565\u3002\u7279\u522b\u662f VPS \u5185\u5b58\u8f83\u5c0f\uff08\u5982 512MB\uff09\u65f6\uff0cXray \u52a0\u4e0a\u5176\u4ed6\u670d\u52a1\uff08\u5982 Nginx\u3001MySQL\uff09\u5bb9\u6613\u89e6\u53d1 OOM\uff0c\u5bfc\u81f4\u670d\u52a1\u95f4\u6b47\u6027\u4e2d\u65ad\u3002<\/p>\n<h2>6. \u5e38\u89c1\u6545\u969c\u5bf9\u7167\u8868<\/h2>\n<p><\/p>\n<table style=\"width:100%;border-collapse:collapse;margin:24px 0;\">\n<thead>\n<tr>\n<th style=\"border:1px solid #ddd;padding:10px;background:#f7f7f7;text-align:left;\">\u6545\u969c\u73b0\u8c61<\/th>\n<th style=\"border:1px solid #ddd;padding:10px;background:#f7f7f7;text-align:left;\">\u53ef\u80fd\u539f\u56e0<\/th>\n<th style=\"border:1px solid #ddd;padding:10px;background:#f7f7f7;text-align:left;\">\u6392\u67e5\u65b9\u5411<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"border:1px solid #ddd;padding:10px;vertical-align:top;\"><strong>\u8fde\u63a5\u8d85\u65f6<\/strong><\/td>\n<td style=\"border:1px solid #ddd;padding:10px;vertical-align:top;\">\u9632\u706b\u5899\u62e6\u622a\u3001\u7aef\u53e3\u672a\u5f00\u653e\u3001ISP \u5c01\u9501<\/td>\n<td style=\"border:1px solid #ddd;padding:10px;vertical-align:top;\">\u68c0\u67e5\u4e91\u5b89\u5168\u7ec4\u3001\u672c\u5730\u9632\u706b\u5899\u3001\u4f7f\u7528 `telnet` \u6d4b\u8bd5\u7aef\u53e3<\/td>\n<\/tr>\n<tr>\n<td style=\"border:1px solid #ddd;padding:10px;vertical-align:top;\"><strong>\u63e1\u624b\u5931\u8d25\/\u534f\u8bae\u9519\u8bef<\/strong><\/td>\n<td style=\"border:1px solid #ddd;padding:10px;vertical-align:top;\">\u914d\u7f6e\u683c\u5f0f\u9519\u8bef\u3001\u534f\u8bae\u7248\u672c\u4e0d\u5339\u914d\u3001UUID \u9519\u8bef<\/td>\n<td style=\"border:1px solid #ddd;padding:10px;vertical-align:top;\">\u68c0\u67e5 JSON \u8bed\u6cd5\u3001\u6838\u5bf9\u5ba2\u6237\u7aef\u4e0e\u670d\u52a1\u7aef\u914d\u7f6e\u7ec6\u8282<\/td>\n<\/tr>\n<tr>\n<td style=\"border:1px solid #ddd;padding:10px;vertical-align:top;\"><strong>\u8bc1\u4e66\u9519\u8bef<\/strong><\/td>\n<td style=\"border:1px solid #ddd;padding:10px;vertical-align:top;\">\u8bc1\u4e66\u8fc7\u671f\u3001\u57df\u540d\u4e0d\u5339\u914d\u3001\u81ea\u7b7e\u540d\u8bc1\u4e66\u672a\u4fe1\u4efb<\/td>\n<td style=\"border:1px solid #ddd;padding:10px;vertical-align:top;\">\u68c0\u67e5\u8bc1\u4e66\u6709\u6548\u671f\u3001\u4f7f\u7528 `openssl` \u9a8c\u8bc1\u8bc1\u4e66\u94fe<\/td>\n<\/tr>\n<tr>\n<td style=\"border:1px solid #ddd;padding:10px;vertical-align:top;\"><strong>\u670d\u52a1\u542f\u52a8\u5931\u8d25<\/strong><\/td>\n<td style=\"border:1px solid #ddd;padding:10px;vertical-align:top;\">\u7aef\u53e3\u88ab\u5360\u7528\u3001\u914d\u7f6e\u6587\u4ef6\u8bed\u6cd5\u9519\u8bef\u3001\u6743\u9650\u4e0d\u8db3<\/td>\n<td style=\"border:1px solid #ddd;padding:10px;vertical-align:top;\">\u68c0\u67e5 `netstat`\u3001\u8fd0\u884c `xray x2ray` \u9a8c\u8bc1\u914d\u7f6e\u3001\u68c0\u67e5\u65e5\u5fd7<\/td>\n<\/tr>\n<tr>\n<td style=\"border:1px solid #ddd;padding:10px;vertical-align:top;\"><strong>\u95f4\u6b47\u6027\u65ad\u5f00<\/strong><\/td>\n<td style=\"border:1px solid #ddd;padding:10px;vertical-align:top;\">\u5185\u5b58\u4e0d\u8db3\u3001IP \u88ab\u5c01\u7981\u3001\u8fd0\u8425\u5546\u52ab\u6301<\/td>\n<td style=\"border:1px solid #ddd;padding:10px;vertical-align:top;\">\u68c0\u67e5 OOM \u65e5\u5fd7\u3001\u66f4\u6362 IP\u3001\u4f7f\u7528 TLS \u4f2a\u88c5<\/td>\n<\/tr>\n<tr>\n<td style=\"border:1px solid #ddd;padding:10px;vertical-align:top;\"><strong>DNS \u89e3\u6790\u5931\u8d25<\/strong><\/td>\n<td style=\"border:1px solid #ddd;padding:10px;vertical-align:top;\">DNS \u6c61\u67d3\u3001\u5ba2\u6237\u7aef DNS \u8bbe\u7f6e\u9519\u8bef<\/td>\n<td style=\"border:1px solid #ddd;padding:10px;vertical-align:top;\">\u66f4\u6539 DNS \u4e3a\u516c\u5171 DNS\uff08\u5982 8.8.8.8\uff09\u3001\u68c0\u67e5 `\/etc\/hosts`<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><\/p>\n<h2>7. \u5982\u4f55\u907f\u514d\u518d\u6b21\u51fa\u73b0\u6b64\u7c7b\u95ee\u9898<\/h2>\n<p>\u6545\u969c\u4fee\u590d\u540e\uff0c\u5efa\u8bae\u91c7\u53d6\u4ee5\u4e0b\u9884\u9632\u63aa\u65bd\uff0c\u4ee5\u63d0\u9ad8 Xray \u670d\u52a1\u7684\u7a33\u5b9a\u6027\uff1a<br \/>\u2022 <strong>\u4f7f\u7528\u914d\u7f6e\u6821\u9a8c\u811a\u672c<\/strong>\uff1a\u5728\u6bcf\u6b21\u4fee\u6539\u914d\u7f6e\u540e\uff0c\u81ea\u52a8\u8fd0\u884c `xray x2ray` \u9a8c\u8bc1\u547d\u4ee4\uff0c\u786e\u4fdd\u914d\u7f6e\u65e0\u8bef\u540e\u518d\u91cd\u542f\u670d\u52a1\u3002<br \/>\u2022 <strong>\u76d1\u63a7\u670d\u52a1\u72b6\u6001<\/strong>\uff1a\u4f7f\u7528 `systemd` \u6216 `supervisor` \u7ba1\u7406 Xray \u8fdb\u7a0b\uff0c\u786e\u4fdd\u670d\u52a1\u5d29\u6e83\u540e\u80fd\u81ea\u52a8\u91cd\u542f\u3002<br \/>\u2022 <strong>\u5b9a\u671f\u66f4\u65b0\u8bc1\u4e66<\/strong>\uff1a\u5982\u679c\u4f7f\u7528\u4e86 Let&#8217;s Encrypt \u7b49\u514d\u8d39\u8bc1\u4e66\uff0c\u8bbe\u7f6e\u81ea\u52a8\u7eed\u671f\u811a\u672c\uff0c\u907f\u514d\u8bc1\u4e66\u8fc7\u671f\u5bfc\u81f4\u7684\u670d\u52a1\u4e2d\u65ad\u3002<br \/>\u2022 <strong>\u5907\u4efd\u914d\u7f6e\u6587\u4ef6<\/strong>\uff1a\u6bcf\u6b21\u4fee\u6539\u914d\u7f6e\u524d\uff0c\u5907\u4efd\u539f\u59cb\u6587\u4ef6\u3002\u53ef\u4ee5\u4f7f\u7528 `git` \u6216\u7b80\u5355\u7684 `cp` \u547d\u4ee4\u8fdb\u884c\u7248\u672c\u63a7\u5236\u3002<br \/>\u2022 <strong>\u76d1\u63a7\u8d44\u6e90\u4f7f\u7528<\/strong>\uff1a\u8bbe\u7f6e\u5185\u5b58\u548c CPU \u4f7f\u7528\u7387\u544a\u8b66\uff0c\u9632\u6b62\u56e0\u8d44\u6e90\u8017\u5c3d\u5bfc\u81f4\u7684\u670d\u52a1\u5d29\u6e83\u3002<\/p>\n<h2>\u603b\u7ed3<\/h2>\n<p>Xray \u5de5\u5177\u65e0\u6cd5\u4f7f\u7528\u7684\u95ee\u9898\uff0c\u7edd\u5927\u591a\u6570\u60c5\u51b5\u4e0b\u53ef\u4ee5\u901a\u8fc7\u201c\u65e5\u5fd7\u5206\u6790 -> \u914d\u7f6e\u9a8c\u8bc1 -> \u7f51\u7edc\u6d4b\u8bd5 -> \u8d44\u6e90\u68c0\u67e5\u201d\u8fd9\u4e00\u6d41\u7a0b\u89e3\u51b3\u3002\u4e0d\u8981\u76f2\u76ee\u66f4\u6362\u914d\u7f6e\u6216\u91cd\u542f\u670d\u52a1\uff0c\u800c\u662f\u5148\u901a\u8fc7\u65e5\u5fd7\u5b9a\u4f4d\u9519\u8bef\u7c7b\u578b\uff0c\u518d\u9488\u5bf9\u6027\u5730\u6392\u67e5\u3002\u4fdd\u6301\u5ba2\u6237\u7aef\u4e0e\u670d\u52a1\u7aef\u7684\u7248\u672c\u517c\u5bb9\u3001\u786e\u4fdd\u7f51\u7edc\u7aef\u53e3\u5f00\u653e\u3001\u4ee5\u53ca\u7ef4\u62a4\u6b63\u786e\u7684\u914d\u7f6e\u6587\u4ef6\uff0c\u662f\u7ef4\u6301\u670d\u52a1\u7a33\u5b9a\u7684\u5173\u952e\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5f53 Xray \u5ba2\u6237\u7aef\uff08\u5982 Xray-core\u3001XrayR\u3001Xray-UI \u7b49\uff09\u7a81\u7136\u65e0\u6cd5\u8fde\u63a5\u6216\u62a5\u9519\u65f6\uff0c\u901a\u5e38\u4e0d\u662f\u8f6f [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1415","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/www.suannai.link\/blog\/wp-json\/wp\/v2\/posts\/1415","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.suannai.link\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.suannai.link\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.suannai.link\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.suannai.link\/blog\/wp-json\/wp\/v2\/comments?post=1415"}],"version-history":[{"count":0,"href":"https:\/\/www.suannai.link\/blog\/wp-json\/wp\/v2\/posts\/1415\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.suannai.link\/blog\/wp-json\/wp\/v2\/media?parent=1415"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.suannai.link\/blog\/wp-json\/wp\/v2\/categories?post=1415"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.suannai.link\/blog\/wp-json\/wp\/v2\/tags?post=1415"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}