{"id":2299,"date":"2025-08-15T19:05:56","date_gmt":"2025-08-15T11:05:56","guid":{"rendered":"https:\/\/www.madbull.site\/?p=2299"},"modified":"2025-08-18T11:03:23","modified_gmt":"2025-08-18T03:03:23","slug":"frp%e5%8f%8d%e5%90%91%e4%bb%a3%e7%90%86","status":"publish","type":"post","link":"https:\/\/www.madbull.site\/?p=2299","title":{"rendered":"frp\u53cd\u5411\u4ee3\u7406\u5de5\u5177"},"content":{"rendered":"\n<p>\u6700\u8fd1\u5728\u5185\u7f51\u73af\u5883\u4f7f\u7528 postfix + dovecot \u642d\u5efa\u4e86\u90ae\u4ef6\u670d\u52a1\u5668\uff0c\u5185\u7f51\u6d4b\u8bd5\u6ca1\u6709\u95ee\u9898\u4e86\uff0c\u9700\u8981\u5728\u516c\u7f51\u4f7f\u7528\u3002\u4e8e\u662f\u627e\u5230\u4e86 frp \u8fd9\u4e2a\u5de5\u5177\uff0c\u53ef\u4ee5\u5c06 \u5185\u7f51 \u7684\u7aef\u53e3\u6620\u5c04\u5230 VPS \u670d\u52a1\u5668\u4e0a\u3002\u603b\u7ed3\u4e86\u4e00\u4e0b\u642d\u5efa\u8fc7\u7a0b\u3002<\/p>\n\n\n\n<p>\u5b98\u65b9\u6587\u6863\u53c2\u770b <a href=\"https:\/\/gofrp.org\/zh-cn\/docs\/\">https:\/\/gofrp.org\/zh-cn\/docs\/<\/a><\/p>\n\n\n\n<p>\u4e4b\u524d\u4ecb\u7ecd\u4e86 ssh\u96a7\u9053\u7684\u65b9\u6cd5\uff0c\u53ef\u4ee5\u53c2\u770b\u5f80\u671f\u6587\u7ae0\uff1a<a href=\"https:\/\/www.madbull.site\/?p=794\">https:\/\/www.madbull.site\/?p=794<\/a> \u3002\u4f46\u662f\u8fd9\u79cd\u65b9\u6cd5\u4e0d\u592a\u7a33\u5b9a\uff0c\u4e34\u65f6\u7528\u53ef\u4ee5\uff0c\u4e0d\u9002\u5408\u957f\u671f\u8fd0\u884c\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">1\u3001\u4e0b\u8f7d<\/h2>\n\n\n\n<p>\u4ece github \u9009\u62e9\u9002\u5408\u81ea\u5df1\u7cfb\u7edf\u7684 frp \u7248\u672c\uff0c\u5730\u5740\u5728 <a href=\"https:\/\/github.com\/fatedier\/frp\/releases\">https:\/\/github.com\/fatedier\/frp\/releases<\/a> \u3002\u6211\u7528\u7684 ubuntu \u7cfb\u7edf\uff0c\u9009\u62e9\u7684\u662f frp_0.63.0_linux_amd64.tar.gz \u7248\u672c\u3002<\/p>\n\n\n\n<p>frp \u7528\u7684 golang \u5199\u7684\uff0c\u89e3\u538b\u540e\u5373\u53ef\u7528\u3002<\/p>\n\n\n\n<p>\u89e3\u538b\u540e\u51714\u4e2a\u6587\u4ef6\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>frps\u548cfrps.toml \u670d\u52a1\u7aef\u7a0b\u5e8f \u548c \u670d\u52a1\u7aef\u914d\u7f6e\u6587\u4ef6<\/strong><\/li>\n\n\n\n<li><strong>frpc\u548cfrpc.toml \u5ba2\u6237\u7aef<strong>\u7a0b\u5e8f<\/strong> \u548c \u5ba2\u6237\u7aef\u914d\u7f6e\u6587\u4ef6<\/strong><\/li>\n<\/ul>\n\n\n\n<p>\u5728 VPS \u8dd1\u670d\u52a1\u7aef\uff0c\u5728\u5185\u7f51\u4e3b\u673a\u4e0a\u8fd0\u884c\u5ba2\u6237\u7aef\u3002\u6211\u8fd9\u91cc\u76f4\u63a5\u89e3\u538b\u5728\u4e86 \/opt \u76ee\u5f55\uff0c\u5e76\u628a\u76ee\u5f55\u6539\u540d\u5b57\u6539\u6210\u4e86 \/opt\/frp<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">2\u3001\u914d\u7f6e<\/h2>\n\n\n\n<p>\u5bf9\u4e8e\u66b4\u6f0f\u5728\u516c\u7f51\u7684\u4ee3\u7406\uff0c\u6709\u4e00\u4e2a\u57fa\u672c\u7684\u5b89\u5168\u8981\u6c42\uff1a\u9700\u8981\u5ba2\u6237\u7aef\u8ba4\u8bc1\u901a\u8fc7\u540e\u624d\u5141\u8bb8\u8fde\u63a5\u3002\u8fd9\u91cc\u4f7f\u7528\u7684 tls \u8bc1\u4e66\u53cc\u5411\u8ba4\u8bc1\uff0c\u5177\u4f53\u914d\u7f6e\u5982\u4e0b\uff1a<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">2.1 \u5728\u670d\u52a1\u7aef<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>bindPort = yourport\ntransport.tls.force = true\ntransport.tls.certFile = \"xx\/xx\/server.crt\"\ntransport.tls.keyFile = \"xx\/xx\/server.key\"\ntransport.tls.trustedCaFile = \"xx\/xx\/ca.crt\"<\/code><\/pre>\n\n\n\n<p>\u914d\u7f6e\u89e3\u91ca\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>bindPort\uff1afrp\u670d\u52a1\u7aef\u76d1\u542c\u7aef\u53e3\u3002\u8981\u4fdd\u8bc1 VPS \u4e0a\u7684\u7f51\u7edc\u5b89\u5168\u7b56\u7565\u5f00\u901a\u4e86\uff0c\u80fd\u591f\u8bbf\u95ee\u3002<\/li>\n\n\n\n<li>transport.tls.force\uff1a\u5f3a\u5236\u4f7f\u7528 tls \u8ba4\u8bc1<\/li>\n\n\n\n<li>transport.tls.certFile \u3001 transport.tls.keyFile\uff1a\u8bc1\u4e66\u6587\u4ef6\u548c\u79c1\u94a5\u6587\u4ef6<\/li>\n\n\n\n<li>transport.tls.trustedCaFile\uff1afrp \u4fe1\u4efb\u7684\u8bc1\u4e66\u3002\u4e5f\u5c31\u662f\u8bf4\uff1a<strong>\u4ee5\u8fd9\u4e2a\u8bc1\u4e66\u4f5c\u4e3a CA \u6839\u8bc1\u4e66\uff0c\u7ed9\u5176\u4ed6 \u670d\u52a1\u6216\u8005\u5ba2\u6237\u7aef \u9881\u53d1\u7684\u8bc1\u4e66\u624d\u80fd\u591f\u901a\u8fc7\u8ba4\u8bc1\u3002<\/strong><\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">2.2 \u5728\u5ba2\u6237\u7aef<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>serverAddr = \"xx.xx.xx.xx\"\nserverPort = yourport\ntransport.tls.enable = true\ntransport.tls.certFile = \"xx\/xx\/client.crt\"\ntransport.tls.keyFile = \"xx\/xx\/client.key\"\ntransport.tls.trustedCaFile = \"xx\/xx\/ca.crt\"\n\n&#91;&#91;proxies]]\nname = \"smtp_25\"\ntype = \"tcp\"\nlocalIP = \"yy.yy.yy.yy\"\nlocalPort = 25\nremotePort = 25\ntransport.proxyProtocolVersion = \"v2\"\n\n&#91;&#91;proxies]]\nname = \"smtp_465\"\ntype = \"tcp\"\nlocalIP = \"yy.yy.yy.yy\"\nlocalPort = 465\nremotePort = 465\ntransport.proxyProtocolVersion = \"v2\"\n\n&#91;&#91;proxies]]\nname = \"imap_143\"\ntype = \"tcp\"\nlocalIP = \"127.0.0.1\"\nlocalPort = 143\nremotePort = 143\n\n&#91;&#91;proxies]]\nname = \"imap_993\"\ntype = \"tcp\"\nlocalIP = \"127.0.0.1\"\nlocalPort = 993\nremotePort = 993\n\n......................\n<\/code><\/pre>\n\n\n\n<p>\u6709\u51e0\u4e2a\u5173\u952e\u7684\u914d\u7f6e\u89e3\u91ca\u4e00\u4e0b\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>serverAddr\uff1afrp\u670d\u52a1\u7aef\u7684\u8fde\u63a5\u5730\u5740<\/li>\n\n\n\n<li>serverPort \uff1afrp\u670d\u52a1\u7aef\u76d1\u542c\u7684\u7aef\u53e3<\/li>\n\n\n\n<li>[[proxies]]\uff1a\u6bcf\u4e00\u4e2a\u6a21\u5757\u90fd\u662f\u4e00\u4e2a\u7aef\u53e3\u6620\u5c04\u5173\u7cfb<\/li>\n\n\n\n<li>localIP\uff1a\u672c\u5730\u670d\u52a1\uff08\u4f8b\u5982\uff1apostfix\uff09\u7684IP\u5730\u5740\u3002<strong>\u6ce8\u610f\uff1a\u5bf9\u4e8e postfix \uff0c \u5982\u679c\u914d\u7f6e\u5f53 \uff0c\u8fde\u63a5 127.0.0.1 \u53ef\u4ee5\u4efb\u610f\u53d1\u9001\u90ae\u4ef6\uff0c\u6240\u4ee5\u5c3d\u91cf\u8fde\u63a5\u7f51\u5361\u4e0a\u7684\u5730\u5740\uff0c\u800c\u4e0d\u662f 127.0.0.1 \u548c localhost\u3002<\/strong><\/li>\n\n\n\n<li>localPort\uff1a\u672c\u5730\u670d\u52a1\uff08\u4f8b\u5982\uff1adovecot\uff09\u76d1\u542c\u7684\u7aef\u53e3\u3002<\/li>\n\n\n\n<li>remotePort\uff1a\u5728\u670d\u52a1\u7aef\u8981\u5bf9\u5916\u5f00\u653e\u7684\u7aef\u53e3\u3002\u4e00\u65e6frp\u5ba2\u6237\u7aef\u5728frp\u670d\u52a1\u7aef\u8ba4\u8bc1\u6210\u529f\uff0c\u5c31\u4f1a\u521b\u5efa\u7684\u76d1\u542c\u7aef\u53e3\u3002<\/li>\n\n\n\n<li>transport.proxyProtocolVersion\uff1a\u8fd9\u662f proxy protocol \u534f\u8bae\u7684\u7248\u672c\u3002\u53ef\u4ee5\u8ba9\u670d\u52a1\u7aef\u83b7\u53d6\u5230\u771f\u5b9e\u7684 \u6e90IP \u548c \u76ee\u7684IP\u3002\u8fd9\u91cc\u7ed9 postfix \u6253\u5f00\u6b64\u529f\u80fd\uff0c\u53ef\u4ee5\u901a\u8fc7\u914d\u7f6e\u6765\u83b7\u53d6\u771f\u5b9e\u7684 \u6e90IP \u5730\u5740\u3002<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">2.3\u3001\u914d\u7f6e\u8bc1\u4e66<\/h3>\n\n\n\n<p>\u9700\u8981\u521b\u5efa 3 \u4e2a\u8bc1\u4e66\/\u79c1\u94a5\u5bf9\uff0c\u51716\u4e2a\u6587\u4ef6\u3002\u6839\u636e\u4e0a\u8fb9\u7684\u914d\u7f6e\uff0c\u5206\u522b\u4ecb\u7ecd\u4e00\u4e0b\u8fd9\u4e9b\u6587\u4ef6\u3002<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u7b2c\u4e00\u5bf9\uff1a\u6839\u8bc1\u4e66 ca.crt \u548c \u6839\u79c1\u94a5 ca.key\u3002\n<ul class=\"wp-block-list\">\n<li>ca.crt \u670d\u52a1\u7aef\u548c\u5ba2\u6237\u6bb5\u90fd <strong>\u9700\u8981\u90e8\u7f72<\/strong>\uff0c\u653e\u5728 transport.tls.trustedCaFile \u7684\u4f4d\u7f6e<\/li>\n\n\n\n<li>ca.key \u7528\u6765\u7ed9\u5ba2\u6237\u7aef\u548c\u670d\u52a1\u7aef\u9881\u53d1\u8bc1\u4e66\u4f7f\u7528\uff0c\u670d\u52a1\u7aef\u548c\u5ba2\u6237\u7aef\u90fd <strong>\u4e0d\u9700\u8981\u90e8\u7f72<\/strong>\u3002<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>\u7b2c\u4e8c\u5bf9\uff1a\u670d\u52a1\u7aef\u8bc1\u4e66 server.crt \u548c \u670d\u52a1\u7aef\u79c1\u94a5 server.key\u3002\u653e\u5728\u670d\u52a1\u7aef transport.tls.certFile \u3001 transport.tls.keyFile \u6307\u5b9a\u7684\u4f4d\u7f6e<\/li>\n\n\n\n<li>\u7b2c\u4e09\u5bf9\uff1a\u5ba2\u6237\u7aef\u8bc1\u4e66 client.crt \u548c \u5ba2\u6237\u7aef\u79c1\u94a5 client.key\u3002\u653e\u5728\u5ba2\u6237\u7aef transport.tls.certFile \u3001 transport.tls.keyFile \u6307\u5b9a\u7684\u4f4d\u7f6e<\/li>\n<\/ul>\n\n\n\n<p>\u6839\u8bc1\u4e66 \u53ef\u4ee5\u4f7f\u7528 \u81ea\u7b7e\u540d \u8bc1\u4e66\u5373\u53ef\uff0c\u53c2\u8003\u5f80\u671f\u6587\u7ae0\uff1a<a href=\"https:\/\/www.madbull.site\/?p=601\">https:\/\/www.madbull.site\/?p=601<\/a><\/p>\n\n\n\n<p>\u5ba2\u6237\u7aef\u8bc1\u4e66 \u7528\u6839\u8bc1\u4e66\u9881\u53d1\uff0c\u53c2\u8003\u5f80\u671f\u6587\u7ae0\uff1a<a href=\"https:\/\/www.madbull.site\/?p=601\">https:\/\/www.madbull.site\/?p=601<\/a> \u4e2d\u7b2c 2.1\u30012.2\u30012.3 \u6240\u4ecb\u7ecd\u7684\u5185\u5bb9\u3002<\/p>\n\n\n\n<p>\u670d\u52a1\u7aef\u8bc1\u4e66 <strong>\u5fc5\u987b\u8981\u4f7f\u7528 \u5305\u542b\u4e3b\u9898\u66ff\u4ee3\u540d \u7684\u8bc1\u4e66<\/strong>\uff0c\u53c2\u8003\u5f80\u671f\u6587\u7ae0\uff1a<a href=\"https:\/\/www.madbull.site\/?p=1111\">https:\/\/www.madbull.site\/?p=1111<\/a>\u3002csr.conf \u914d\u7f6e\u6587\u4ef6\u4e2d alt_names \u6bb5\u91cc\u7684 DNS.1 \u548c IP.1 \u8bbe\u7f6e\u6210\u4f60\u5408\u9002\u7684 \u57df\u540d \u548c IP \u5373\u53ef\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">3\u3001\u542f\u52a8<\/h2>\n\n\n\n<p>\u53ef\u4ee5\u76f4\u63a5\u624b\u52a8\u542f\u52a8\uff0c\u4f8b\u5982\uff1a\/opt\/frp\/frps -c \/opt\/frp\/frps.toml\u3002\u4e3a\u4e86\u65b9\u4fbf\uff0c\u6211\u5206\u522b\u5199\u4e86\u4e24\u4e2a service \u914d\u7f6e\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">3.1\u3001\u670d\u52a1\u7aef<\/h3>\n\n\n\n<p>\u6587\u4ef6\u8def\u5f84\uff1a\/usr\/lib\/systemd\/system\/frps.service<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;Unit]\nDescription=frps Service\nAfter=basic.target network.target redis.service mysql.service\n\n&#91;Service]\nType=simple\nWorkingDirectory=\/opt\/frp\nExecStart=\/opt\/frp\/frps -c \/opt\/frp\/frps.toml\nRestart=always\nRestartSec=5\nStartLimitBurst=0\n\n&#91;Install]\nWantedBy=multi-user.target<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">3.2\u3001\u5ba2\u6237\u7aef<\/h3>\n\n\n\n<p>\u6587\u4ef6\u8def\u5f84\uff1a\/usr\/lib\/systemd\/system\/frpc.service<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;Unit]\nDescription=frpc Service\nAfter=basic.target network.target redis.service mysql.service dovecot.service postfix.service\n\n&#91;Service]\nType=simple\nWorkingDirectory=\/opt\/frp\nExecStart=\/opt\/frp\/frpc -c \/opt\/frp\/frpc.toml\nRestart=always\nRestartSec=5\nStartLimitBurst=0\n\n&#91;Install]\nWantedBy=multi-user.target<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">4\u3001\u6700\u540e<\/h2>\n\n\n\n<p>\u4ee5\u4e0a\u5c31\u5df2\u7ecf\u90e8\u7f72\u5b8c\u6bd5\uff0c\u4f7f\u7528 systemctl start\/stop\/status\/enable \u6765\u542f\u505c\u3001\u8bbe\u7f6e\u5f00\u673a\u542f\u52a8\u5373\u53ef\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6700\u8fd1\u5728\u5185\u7f51\u73af\u5883\u4f7f\u7528 postfix + dovecot \u642d\u5efa\u4e86\u90ae\u4ef6\u670d\u52a1\u5668\uff0c\u5185\u7f51\u6d4b\u8bd5\u6ca1\u6709\u95ee\u9898\u4e86\uff0c\u9700\u8981\u5728\u516c\u7f51\u4f7f\u7528\u3002 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":450,"comment_status":"open","ping_status":"open","sticky":false,"template":"wp-custom-template-my","format":"standard","meta":{"footnotes":""},"categories":[135,166,131],"tags":[287,237,19],"class_list":["post-2299","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux","category-tools","category-131","tag-golang","tag-linux","tag-19"],"_links":{"self":[{"href":"https:\/\/www.madbull.site\/index.php?rest_route=\/wp\/v2\/posts\/2299","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.madbull.site\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.madbull.site\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.madbull.site\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.madbull.site\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2299"}],"version-history":[{"count":3,"href":"https:\/\/www.madbull.site\/index.php?rest_route=\/wp\/v2\/posts\/2299\/revisions"}],"predecessor-version":[{"id":2305,"href":"https:\/\/www.madbull.site\/index.php?rest_route=\/wp\/v2\/posts\/2299\/revisions\/2305"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.madbull.site\/index.php?rest_route=\/wp\/v2\/media\/450"}],"wp:attachment":[{"href":"https:\/\/www.madbull.site\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2299"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.madbull.site\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2299"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.madbull.site\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2299"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}