{"id":307,"date":"2022-08-16T11:40:55","date_gmt":"2022-08-16T03:40:55","guid":{"rendered":"https:\/\/blog.iiiz.org\/?p=307"},"modified":"2023-09-08T13:27:22","modified_gmt":"2023-09-08T05:27:22","slug":"%e5%88%a9%e7%94%a8frp%e6%9e%84%e5%bb%ba%e5%86%85%e7%bd%91%e7%a9%bf%e9%80%8f%e6%9c%8d%e5%8a%a1","status":"publish","type":"post","link":"https:\/\/blog.ineuro.net\/index.php\/2022\/08\/16\/307\/","title":{"rendered":"\u5229\u7528frp\u6784\u5efa\u5185\u7f51\u7a7f\u900f\u670d\u52a1"},"content":{"rendered":"<h2>\u4e00\u3001frps\u901a\u8fc7docker\u8fdb\u884c\u670d\u52a1\u5668\u7aef\u914d\u7f6e<\/h2>\n<h3>1.\u9996\u5148\u5728\/etc\u4e0b\u65b0\u5efa\u6587\u4ef6\u5939frp\uff0c\u901a\u8fc7vim\u547d\u4ee4\u65b0\u5efafrps.ini\u6587\u4ef6\u5982\u4e0b<\/h3>\n<pre><code class=\"language-c\">[common]\n# \u76d1\u542c\u7aef\u53e3\nbind_port = 0000\n# \u9762\u677f\u7aef\u53e3\ndashboard_port = 0000\n# \u767b\u5f55\u9762\u677f\u8d26\u53f7\u8bbe\u7f6e\ndashboard_user = a\ndashboard_pwd = a\n# \u8bbe\u7f6ehttp\u53cahttps\u534f\u8bae\u4e0b\u4ee3\u7406\u7aef\u53e3\uff08\u975e\u91cd\u8981\uff09\nvhost_http_port = a\nvhost_https_port = a\n\n# \u8eab\u4efd\u9a8c\u8bc1\ntoken = token<\/code><\/pre>\n<p>\u5176\u4e2d\uff0c\u767b\u5f55\u9762\u677f\u8d26\u53f7\u5bc6\u7801\u5747\u53ef\u81ea\u5df1\u8bbe\u7f6e\uff0c\u8eab\u4efd\u9a8c\u8bc1token\u8bbe\u7f6e\u7684\u590d\u6742\u4e00\u70b9\u3002<\/p>\n<h3>2.\u62c9\u53d6docker\u4e2d\u7684frps<\/h3>\n<pre><code class=\"language-c\">docker pull snowdreamtech\/frps:latest<\/code><\/pre>\n<h3>3.\u8fd0\u884cfrps\u5bb9\u5668<\/h3>\n<pre><code class=\"language-c\">docker run --restart=always --network host -d -v \/etc\/frp\/frps.ini:\/etc\/frp\/frps.ini --name frps snowdreamtech\/frps<\/code><\/pre>\n<h3>4.\u8f93\u5165\u547d\u4ee4docker ps\u67e5\u770b\u5bb9\u5668\u8fd0\u884c\u72b6\u6001\uff0c\u8f93\u5165IP\uff1aport\u5373\u53ef\u767b\u5f55frps\u9762\u677f\u3002<\/h3>\n<h2>2.frpc\u7528\u6237\u7aef\u7b49\u5f85\u540e\u7eed\u66f4\u65b0\u2026\u2026<\/h2>\n<p>\u9644\uff1adocker\u5e38\u89c1\u76f8\u5173\u547d\u4ee4<br \/>\nDocker start\/stop\/restart \u547d\u4ee4<br \/>\ndocker start :\u542f\u52a8\u4e00\u4e2a\u6216\u591a\u4e2a\u5df2\u7ecf\u88ab\u505c\u6b62\u7684\u5bb9\u5668<br \/>\ndocker stop :\u505c\u6b62\u4e00\u4e2a\u8fd0\u884c\u4e2d\u7684\u5bb9\u5668<br \/>\ndocker restart :\u91cd\u542f\u5bb9\u5668<\/p>\n<pre><code class=\"language-r\">docker start [OPTIONS] CONTAINER [CONTAINER...]\ndocker stop [OPTIONS] CONTAINER [CONTAINER...]\ndocker stop [OPTIONS] CONTAINER [CONTAINER...]\n#\u67e5\u770b\u5df2\u62c9\u53d6\u955c\u50cf\ndocker images<\/code><\/pre>\n<h4>docker\u5bb9\u5668\u7684\u91cd\u542f\u7b56\u7565<\/h4>\n<p>no\uff0c\u9ed8\u8ba4\u7b56\u7565\uff0c\u5728\u5bb9\u5668\u9000\u51fa\u65f6\u4e0d\u91cd\u542f\u5bb9\u5668<br \/>\non-failure\uff0c\u5728\u5bb9\u5668\u975e\u6b63\u5e38\u9000\u51fa\u65f6\uff08\u9000\u51fa\u72b6\u6001\u975e0\uff09\uff0c\u624d\u4f1a\u91cd\u542f\u5bb9\u5668<br \/>\non-failure:3\uff0c\u5728\u5bb9\u5668\u975e\u6b63\u5e38\u9000\u51fa\u65f6\u91cd\u542f\u5bb9\u5668\uff0c\u6700\u591a\u91cd\u542f3\u6b21<br \/>\nalways\uff0c\u5728\u5bb9\u5668\u9000\u51fa\u65f6\u603b\u662f\u91cd\u542f\u5bb9\u5668<br \/>\nunless-stopped\uff0c\u5728\u5bb9\u5668\u9000\u51fa\u65f6\u603b\u662f\u91cd\u542f\u5bb9\u5668\uff0c\u4f46\u662f\u4e0d\u8003\u8651\u5728Docker\u5b88\u62a4\u8fdb\u7a0b\u542f\u52a8\u65f6\u5c31\u5df2\u7ecf\u505c\u6b62\u4e86\u7684\u5bb9\u5668<\/p>\n<h4>docker run\u9009\u9879<\/h4>\n<p>-a stdin: \u6307\u5b9a\u6807\u51c6\u8f93\u5165\u8f93\u51fa\u5185\u5bb9\u7c7b\u578b\uff0c\u53ef\u9009 STDIN\/STDOUT\/STDERR \u4e09\u9879\uff1b<br \/>\n-d: \u540e\u53f0\u8fd0\u884c\u5bb9\u5668\uff0c\u5e76\u8fd4\u56de\u5bb9\u5668ID\uff1b<br \/>\n-i: \u4ee5\u4ea4\u4e92\u6a21\u5f0f\u8fd0\u884c\u5bb9\u5668\uff0c\u901a\u5e38\u4e0e -t \u540c\u65f6\u4f7f\u7528\uff1b<br \/>\n-P: \u968f\u673a\u7aef\u53e3\u6620\u5c04\uff0c\u5bb9\u5668\u5185\u90e8\u7aef\u53e3\u968f\u673a\u6620\u5c04\u5230\u4e3b\u673a\u7684\u7aef\u53e3<br \/>\n-p: \u6307\u5b9a\u7aef\u53e3\u6620\u5c04\uff0c\u683c\u5f0f\u4e3a\uff1a\u4e3b\u673a(\u5bbf\u4e3b)\u7aef\u53e3:\u5bb9\u5668\u7aef\u53e3<br \/>\n-t: \u4e3a\u5bb9\u5668\u91cd\u65b0\u5206\u914d\u4e00\u4e2a\u4f2a\u8f93\u5165\u7ec8\u7aef\uff0c\u901a\u5e38\u4e0e -i \u540c\u65f6\u4f7f\u7528\uff1b<br \/>\n&#8211;name=&#8221;nginx-lb&#8221;: \u4e3a\u5bb9\u5668\u6307\u5b9a\u4e00\u4e2a\u540d\u79f0\uff1b<br \/>\n&#8211;dns 8.8.8.8: \u6307\u5b9a\u5bb9\u5668\u4f7f\u7528\u7684DNS\u670d\u52a1\u5668\uff0c\u9ed8\u8ba4\u548c\u5bbf\u4e3b\u4e00\u81f4\uff1b<br \/>\n&#8211;dns-search example.com: \u6307\u5b9a\u5bb9\u5668DNS\u641c\u7d22\u57df\u540d\uff0c\u9ed8\u8ba4\u548c\u5bbf\u4e3b\u4e00\u81f4\uff1b<br \/>\n-h &#8220;mars&#8221;: \u6307\u5b9a\u5bb9\u5668\u7684hostname\uff1b<br \/>\n-e username=&#8221;ritchie&#8221;: \u8bbe\u7f6e\u73af\u5883\u53d8\u91cf\uff1b<br \/>\n&#8211;env-file=[]: \u4ece\u6307\u5b9a\u6587\u4ef6\u8bfb\u5165\u73af\u5883\u53d8\u91cf\uff1b<br \/>\n&#8211;cpuset=&#8221;0-2&#8243; or &#8211;cpuset=&#8221;0,1,2&#8243;: \u7ed1\u5b9a\u5bb9\u5668\u5230\u6307\u5b9aCPU\u8fd0\u884c\uff1b<br \/>\n-m :\u8bbe\u7f6e\u5bb9\u5668\u4f7f\u7528\u5185\u5b58\u6700\u5927\u503c\uff1b<br \/>\n&#8211;net=&#8221;bridge&#8221;: \u6307\u5b9a\u5bb9\u5668\u7684\u7f51\u7edc\u8fde\u63a5\u7c7b\u578b\uff0c\u652f\u6301 bridge\/host\/none\/container: \u56db\u79cd\u7c7b\u578b\uff1b<br \/>\n&#8211;link=[]: \u6dfb\u52a0\u94fe\u63a5\u5230\u53e6\u4e00\u4e2a\u5bb9\u5668\uff1b<br \/>\n&#8211;expose=[]: \u5f00\u653e\u4e00\u4e2a\u7aef\u53e3\u6216\u4e00\u7ec4\u7aef\u53e3\uff1b<br \/>\n&#8211;volume , -v: \u7ed1\u5b9a\u4e00\u4e2a\u5377<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e00\u3001frps\u901a\u8fc7docker\u8fdb\u884c\u670d\u52a1\u5668\u7aef\u914d\u7f6e 1.\u9996\u5148\u5728\/etc\u4e0b\u65b0\u5efa\u6587\u4ef6\u5939frp\uff0c\u901a\u8fc7vim\u547d\u4ee4\u65b0\u5efafrps [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1,24],"tags":[],"topics":[],"_links":{"self":[{"href":"https:\/\/blog.ineuro.net\/index.php\/wp-json\/wp\/v2\/posts\/307"}],"collection":[{"href":"https:\/\/blog.ineuro.net\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.ineuro.net\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.ineuro.net\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.ineuro.net\/index.php\/wp-json\/wp\/v2\/comments?post=307"}],"version-history":[{"count":13,"href":"https:\/\/blog.ineuro.net\/index.php\/wp-json\/wp\/v2\/posts\/307\/revisions"}],"predecessor-version":[{"id":340,"href":"https:\/\/blog.ineuro.net\/index.php\/wp-json\/wp\/v2\/posts\/307\/revisions\/340"}],"wp:attachment":[{"href":"https:\/\/blog.ineuro.net\/index.php\/wp-json\/wp\/v2\/media?parent=307"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.ineuro.net\/index.php\/wp-json\/wp\/v2\/categories?post=307"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.ineuro.net\/index.php\/wp-json\/wp\/v2\/tags?post=307"},{"taxonomy":"topics","embeddable":true,"href":"https:\/\/blog.ineuro.net\/index.php\/wp-json\/wp\/v2\/topics?post=307"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}