{"id":153,"date":"2018-03-24T08:28:28","date_gmt":"2018-03-24T00:28:28","guid":{"rendered":"http:\/\/kkong.net\/?p=153"},"modified":"2018-03-25T23:46:26","modified_gmt":"2018-03-25T15:46:26","slug":"frp%e5%85%a8%e5%90%8dfast-reverse-proxy-%e7%a9%bf%e8%b6%8a%e5%86%85%e7%bd%91","status":"publish","type":"post","link":"https:\/\/kkong.net\/?p=153","title":{"rendered":"frp\u5168\u540dFast Reverse Proxy \u7a7f\u8d8a\u5185\u7f51\u52a0\u81ea\u542f\u52a8\uff01"},"content":{"rendered":"<p>Frp\u57fa\u672c\u4fe1\u606f<\/p>\n<p>frp\u5168\u540dFast Reverse Proxy\uff0c\u662f\u7528\u4e8e\u63d0\u4f9b\u5185\u7f51\u7a7f\u900f\u670d\u52a1\u7684\u5de5\u5177\uff0c\u4e3b\u8981\u7528\u4e8e\u89e3\u51b3\u4e00\u4e9b\u5185\u7f51\u670d\u52a1\u6ca1\u6709\u516c\u7f51ip\u4f46\u662f\u5374\u9700\u8981\u63d0\u4f9b\u5916\u7f51\u8bbf\u95ee\u7684\u95ee\u9898\u3002\u4f7f\u7528frp\u4f60\u53ef\u4ee5\u5c06\u5185\u7f51\u4e2d\u7684TCP\u3001UDP\u3001HTTP\u3001HTTPS\u7b49\u534f\u8bae\u7c7b\u578b\u7684\u670d\u52a1\u53d1\u5e03\u5230\u516c\u7f51\uff0c\u5e76\u4e14\u652f\u6301Web\u670d\u52a1\u6839\u636e\u57df\u540d\u8fdb\u884c\u8def\u7531\u8f6c\u53d1\u3002<br \/>\nfrp\u5df2\u7ecf\u5c06\u9879\u76ee\u5f00\u6e90\u81f3github\uff0c\u60f3\u6df1\u5165\u4e86\u89e3\u7684\u670b\u53cb\u53ef\u4ee5\u70b9\u51fb\u8df3\u8f6c\u5730\u5740\uff0c\u8fdb\u884c\u6df1\u5165\u4e86\u89e3\uff1agithub\u9879\u76ee\u5730\u5740(frp)<\/p>\n<p>Frp\u4f7f\u7528\u8981\u6c42<br \/>\n<img loading=\"lazy\" class=\"alignnone size-full wp-image-154\" src=\"http:\/\/kkong.net\/wp-content\/uploads\/2018\/03\/frp\u67b6\u6784\u56fe.png\" alt=\"\" width=\"581\" height=\"436\" \/><\/p>\n<p>\u5982\u4e0a\u56fe\u7684frp\u67b6\u6784\u56fe\u6240\u793a\uff1a1\u3001\uff08\u5fc5\u987b\uff09\u60f3\u8981\u4f7f\u7528frp\u670d\u52a1\uff0c\u5c06\u5185\u7f51\u4e2d\u7684\u670d\u52a1\u53d1\u5e03\u5230\u516c\u7f51\u3002\u4f60\u9700\u8981\u5148\u62e5\u6709\u4e00\u53f0\u62e5\u6709\u516c\u7f51ip\u7684\u7f51\u7edc\u8bbe\u7f6e\u642d\u5efafrp\u670d\u52a1\u7aef\uff0c\u518d\u5728\u5185\u7f51\u9700\u8981\u7a7f\u900f\u7684\u8bbe\u7f6e\u4e2d\u642d\u5efafrp\u5ba2\u6237\u7aef\u670d\u52a1\u624d\u80fd\u8fdb\u884c\u7a7f\u900f\uff1b2\u3001\uff08\u975e\u5fc5\u9700\uff09\u4f60\u9700\u8981\u62e5\u6709\u4e00\u4e2a\u57df\u540d\u89e3\u6790\u5230\u516c\u7f51\u7684ip\u5730\u5740\uff0c\u624d\u80fd\u591f\u5b9e\u73b0web\u670d\u52a1\u7684\u901a\u8fc7\u57df\u540d\u8fdb\u884c\u8def\u7531\u8f6c\u53d1\u7684\u529f\u80fd\u3002<\/p>\n<p>Frp\u670d\u52a1\u7684\u642d\u5efa<\/p>\n<p>\u642d\u5efafrp\u5f88\u7b80\u5355\uff0c\u5173\u952e\u7684\u6b65\u9aa4\u53ea\u6709\u4e09\u6b65\uff1a1\u3001\u83b7\u53d6frp\u6587\u4ef6\uff1b2\u3001\u8bbe\u7f6efrp\u914d\u7f6e\u6587\u4ef6\uff0c3\u3001\u542f\u52a8frp\u670d\u52a1\u3002\uff08\u6ce8\u610ffrp\u642d\u5efa\u7684\u7684\u8fd9\u4e09\u6b65\u662f\u5206\u4e3a\u5ba2\u6237\u7aef\u548c\u670d\u52a1\u7aef\u7684\uff0c\u4f46\u662f\u64cd\u4f5c\u57fa\u672c\u662f\u4e00\u81f4\u7684\u3002\uff09\u672c\u6559\u7a0bfrp\u670d\u52a1\u7684\u642d\u5efa\u4e3b\u8981\u4ecb\u7ecdfrp\u642d\u5efa\u7684\u4e3b\u8981\u4e09\u6b65\uff0c\u4ee5\u53cafrp\u670d\u52a1\u7aef\u548c\u5ba2\u6237\u7aef\u914d\u7f6e\u6587\u4ef6\u5185\u5bb9\u7684\u89e3\u91ca\u8bf4\u660e\uff0c\u4ee5\u53ca\u5982\u4f55\u5c06frp\u5728linux\u7cfb\u7edf\u4e2d\u521b\u5efasystemd\u670d\u52a1\uff0c\u8fdb\u884c\u670d\u52a1\u7ba1\u7406\u3002<\/p>\n<p>\u7b2c\u4e00\u6b65\uff1a\u83b7\u53d6frp\u6587\u4ef6<br \/>\nfrp\u652f\u6301linux\u5e73\u53f0\u548cwindows\u5e73\u53f0\u3002\u53c2\u7167\u4f60\u7684\u8bbe\u7f6e\u7684\u8fd0\u884c\u5e73\u53f0\u4e0b\u8f7dlinux\u7248\u672c\u7684\u6587\u4ef6\u6216\u8005\u662fwindows\u7684\u3002https:\/\/github.com\/fatedier\/frp\/releases<br \/>\n\u4e00\u822clinux\u5e73\u53f0\u4e0b\u8f7d\u7684\u7248\u672c\u4e3a\uff1afrp_\u7248\u672c\u53f7_linux_amd64.tar.gz\uff0cwindows\u5e73\u53f0\u4e0b\u8f7d\u7684\u7248\u672c\u4e3a\uff1afrp_\u7248\u672c\u53f7_windows_amd64.zip\u3002linux\u7248\u672c\u6587\u4ef6\u7684\u89e3\u538b\u547d\u4ee4\u4e3atar zxvf \u6587\u4ef6\u540d \uff0cwindows\u7248\u672c\u6587\u4ef6\u76f4\u63a5\u53f3\u952e\u89e3\u538b\u5373\u53ef\u3002\u6587\u4ef6\u89e3\u538b\u540e\uff0c\u4e00\u822c\u90fd\u542b\u6709frps(frp\u670d\u52a1\u7aef\u8fd0\u884c\u6587\u4ef6)\u3001frpc(frp\u5ba2\u6237\u7aef\u8fd0\u884c\u6587\u4ef6)\u3001frps.ini(frp\u670d\u52a1\u7aef\u914d\u7f6e\u6587\u4ef6)\u3001frpc.ini(frp\u5ba2\u6237\u7aef\u914d\u7f6e\u6587\u4ef6)\uff0c\u4ee5\u53cafrp_full.ini(frp\u5168\u90e8\u914d\u7f6e\u6587\u4ef6\u89e3\u91ca\u8bf4\u660e\u548c\u53c2\u8003\u3002)<\/p>\n<p>\u7b2c\u4e8c\u6b65\uff1afrp\u914d\u7f6e\u6587\u4ef6\u8bbe\u7f6e<br \/>\nfrp\u914d\u7f6e\u6587\u4ef6\u5206\u4e3a\u670d\u52a1\u7aef\u548c\u5ba2\u6237\u7aef\uff0c\u60f3\u8981\u6b63\u5e38\u53ea\u7528frp\u5de5\u5177\uff0c\u6211\u4eec\u9700\u8981\u5bf9\u670d\u52a1\u7aef\u548c\u5ba2\u6237\u7aef\u7684\u914d\u7f6e\u6587\u4ef6\u5206\u522b\u8fdb\u884c\u8bbe\u7f6e\u3002<\/p>\n<p>frps.ini\uff08\u670d\u52a1\u7aef\uff09\u914d\u7f6e\u6587\u4ef6\u89e3\u91ca\u8bf4\u660e<\/p>\n<p># [common] is integral section<br \/>\n[common]<br \/>\n# A literal address or host name for IPv6 must be enclosed<br \/>\n# in square brackets, as in \u201c[::1]:80\u201d, \u201c[ipv6-host]:http\u201d or \u201c[ipv6-host%zone]:80\u201d<br \/>\nbind_addr = 0.0.0.0<br \/>\nbind_port = 7000<\/p>\n<p># udp port to help make udp hole to penetrate nat<br \/>\nbind_udp_port = 7001<\/p>\n<p># udp port used for kcp protocol, it can be same with \u2018bind_port\u2019<br \/>\n# if not set, kcp is disabled in frps<br \/>\nkcp_bind_port = 7000<\/p>\n<p># specify which address proxy will listen for, default value is same with bind_addr<br \/>\n# proxy_bind_addr = 127.0.0.1<\/p>\n<p># if you want to support virtual host, you must set the http port for listening (optional)<br \/>\nvhost_http_port = 80<br \/>\nvhost_https_port = 443<\/p>\n<p># set dashboard_addr and dashboard_port to view dashboard of frps<br \/>\n# dashboard_addr\u2019s default value is same with bind_addr<br \/>\n# dashboard is available only if dashboard_port is set<br \/>\ndashboard_addr = 0.0.0.0<br \/>\ndashboard_port = 7500<\/p>\n<p># dashboard user and pwd for basic auth protect, if not set, both default value is admin<br \/>\ndashboard_user = admin<br \/>\ndashboard_pwd = admin<\/p>\n<p># dashboard assets directory(only for debug mode)<br \/>\n# assets_dir = .\/static<br \/>\n# console or real logFile path like .\/frps.log<br \/>\nlog_file = .\/frps.log<\/p>\n<p># trace, debug, info, warn, error<br \/>\nlog_level = info<\/p>\n<p>log_max_days = 3<\/p>\n<p># privilege mode is the only supported mode since v0.10.0<br \/>\nprivilege_token = 12345678<\/p>\n<p># heartbeat configure, it\u2019s not recommended to modify the default value<br \/>\n# the default value of heartbeat_timeout is 90<br \/>\n# heartbeat_timeout = 90<\/p>\n<p># only allow frpc to bind ports you list, if you set nothing, there won\u2019t be any limit<br \/>\nprivilege_allow_ports = 2000-3000,3001,3003,4000-50000<\/p>\n<p># pool_count in each proxy will change to max_pool_count if they exceed the maximum value<br \/>\nmax_pool_count = 5<\/p>\n<p># max ports can be used for each client, default value is 0 means no limit<br \/>\nmax_ports_per_client = 0<\/p>\n<p># authentication_timeout means the timeout interval (seconds) when the frpc connects frps<br \/>\n# if authentication_timeout is zero, the time is not verified, default is 900s<br \/>\nauthentication_timeout = 900<\/p>\n<p># if subdomain_host is not empty, you can set subdomain when type is http or https in frpc\u2019s configure file<br \/>\n# when subdomain is test, the host used by routing is test.frps.com<br \/>\nsubdomain_host = frps.com<\/p>\n<p># if tcp stream multiplexing is used, default is true<br \/>\ntcp_mux = true<\/p>\n<p>=================\u5206\u5272\u7ebf======================<\/p>\n<p>frpc.ini\uff08\u5ba2\u6237\u7aef\uff09\u914d\u7f6e\u6587\u4ef6\u89e3\u91ca\u8bf4\u660e<br \/>\n\u5bf9\u5e94\u7a7f\u900f\u670d\u52a1\u540d\u79f0<br \/>\n[name]<br \/>\n\u5efa\u7acb\u6bcf\u4e2a\u7a7f\u900f\u670d\u52a1\uff0c\u90fd\u9700\u8981\u547d\u540d\u4e00\u4e2a\u6b64\u670d\u52a1\u7684\u540d\u79f0\uff0c\u4e0d\u80fd\u548c\u5176\u4ed6\u5df2\u5efa\u7acb\u7684\u76f8\u540c\u3002<\/p>\n<p>\u7a7f\u900f\u534f\u8bae\u7c7b\u578b<br \/>\ntype = tcp<br \/>\n\u53ef\u9009\uff1atcp\uff0cudp\uff0chttp\uff0chttps\uff0cstcp\uff0cxtcp<br \/>\n\u4f60\u8981\u7a7f\u900f\u4ec0\u4e48\u5e94\u7528\u8981\u641e\u6e05\u695a\uff0c\u6b64\u5e94\u7528\u662f\u7528\u4ec0\u4e48\u534f\u8bae\u7684\u3002<\/p>\n<p>\u672c\u5730\u76d1\u542cIP<br \/>\nlocal_ip = 127.0.0.1<br \/>\n\u53ef\u4ee5\u662f\u672c\u5730\u7684\u5c40\u57df\u7f51IP\uff0c\u4e5f\u53ef\u4ee5\u662f\u672c\u673a\u7684127.0.0.1 IP\uff0c<br \/>\n\u4f8b\u5982\u4f60\u7684\u5c40\u57df\u7f51\u662f\u4e92\u901a\u7684\uff0c\u4f60\u53ef\u4ee5\u5728\u672c\u8bbe\u5907\u5efa\u7acb\u7a7f\u900f\u5c40\u57df\u7f51\u5176\u4ed6IP\u7684\u5e94\u7528\u3002<\/p>\n<p>\u672c\u5730\u76d1\u542c\u7aef\u53e3<br \/>\nlocal_port = 22<br \/>\n0.16.0\u7248\u672c\u4ee5\u4e0a\u652f\u6301\u6279\u91cf\u7aef\u53e3\u7ed1\u5b9a<br \/>\nlocal_port = 21,22,3389,10010-10020<br \/>\n\u4f7f\u7528\u5c0f\u5199\u9017\u53f7\u3010,\u3011\u5206\u9694\uff0c\u6216\u8005\u4e00\u6bb5\u8303\u56f4\u7aef\u53e3\u7684\u7528\u3010-\u3011\u5c0f\u5199\u6a2a\u6760\u7b26\u53f7\u7f16\u5199\u8303\u56f4\u3002<br \/>\n\u7528\u4e8e\u76d1\u542c\u672c\u5730\u8bbe\u5907\u9700\u8981\u7a7f\u900f\u7684\u7aef\u53e3\uff0c\u6bd4\u5982\u6211\u8981\u7a7f\u900f\u5230\u672c\u673a\u7684SSH\u7aef\u53e3\uff0c\u800cSSH\u7aef\u53e3\u4e3a22\uff0c\u5219\u8fd9\u6837\u7406\u89e3\u3002<\/p>\n<p>\u8fdc\u7a0b\u76d1\u542c\u7aef\u53e3<br \/>\nremote_port = 6001<br \/>\n0.16.0\u7248\u672c\u4ee5\u4e0a\u652f\u6301\u6279\u91cf\u7aef\u53e3\u7ed1\u5b9a<br \/>\nremote_port = 6001,6002,8080,50010-50020<br \/>\n\u4f7f\u7528\u5c0f\u5199\u9017\u53f7\u3010,\u3011\u5206\u9694\uff0c\u6216\u8005\u4e00\u6bb5\u8303\u56f4\u7aef\u53e3\u7684\u7528\u3010-\u3011\u5c0f\u5199\u6a2a\u6760\u7b26\u53f7\u7f16\u5199\u8303\u56f4\u3002<br \/>\n\u7528\u4e8efrps\u670d\u52a1\u7aef\u7684\uff0c\u5206\u914d\u5efa\u7acb\u7a7f\u900f\u5230\u5185\u7f51\u5bf9\u5e94\u5e94\u7528\u7684\u516c\u7f51\u7aef\u53e3\u3002<br \/>\n\u9700\u8981frps\u670d\u52a1\u7aef\u5df2\u5f00\u653e\u6b64\u7aef\u53e3\u7ed9frpc\u5ba2\u6237\u7aef\u5141\u8bb8\u5bf9\u63a5\u4f7f\u7528\u3002<br \/>\n\u4f8b\u5982\u6211\u53ef\u4ee5\u8fde\u63a5\u5230\u6b64(frps\u670d\u52a1\u7aefIP\uff1a\u7aef\u53e3)\uff0c\u5219\u53ef\u4ee5\u7a7f\u900f\u5230\u6211\u7684\u5185\u7f51\u5bf9\u5e94\u5e94\u7528\u670d\u52a1\u3002<\/p>\n<p>\u7a7f\u900f\u901a\u8baf\u52a0\u5bc6<br \/>\nuse_encryption = false<br \/>\n\u53ef\u9009\uff1afalse,true<br \/>\n\u9ed8\u8ba4\u4e3afalse\u5219\u4e0d\u5f00\u542f\uff0c\u6216\u8005\u4e0d\u586b\u6b64\u53c2\u6570\uff0c\u4e3atrue\u5219\u5f00\u542ffrps\u670d\u52a1\u7aef\u548cfrpc\u5ba2\u6237\u7aef\u4e4b\u95f4\u901a\u8baf\u52a0\u5bc6\u3002<\/p>\n<p>\u7a7f\u900f\u901a\u8baf\u538b\u7f29<br \/>\nuse_compression = false<br \/>\n\u53ef\u9009\uff1afalse,true<br \/>\n\u9ed8\u8ba4\u4e3afalse\u5219\u4e0d\u5f00\u542f\uff0c\u6216\u8005\u4e0d\u586b\u6b64\u53c2\u6570\uff0c\u4e3atrue\u5219\u5f00\u542ffrps\u670d\u52a1\u7aef\u548cfrpc\u5ba2\u6237\u7aef\u4e4b\u95f4\u901a\u8baf\u538b\u7f29\u3002<\/p>\n<p>\u5206\u914d\u81ea\u5b9a\u4e49\u57df\u540d\u8bbf\u95ee\u7a7f\u900f\u670d\u52a1<br \/>\ncustom_domains = demo.com<br \/>\n\u652f\u6301\u586b\u5199\u591a\u4e2a\u57df\u540d<br \/>\ncustom_domains = demo.com,abc123.com,test.com<br \/>\n\u4f7f\u7528\u5c0f\u5199\u9017\u53f7\u3010,\u3011\u5206\u9694\u6bcf\u4e2a\u57df\u540d<br \/>\n\u7528\u4e8e\u4f60\u7684\u7a7f\u900f\u670d\u52a1\u7684\u552f\u4e00\u8bbf\u95ee\u57df\u540d\uff0c\u5047\u5982\u6ca1\u6709\u57df\u540d\uff0c\u5219\u6b64\u5904\u8bf7\u586b\u4e3afrps\u670d\u52a1\u7aef\u7684\u670d\u52a1\u5668(IP)<br \/>\n\u81ea\u5df1\u6709\u591a\u4e2a\u57df\u540d\uff0c\u53ef\u4ee5\u914d\u7f6e\u4e0d\u540c\u7a7f\u900f\u5e94\u7528\u670d\u52a1\uff0c\u7528\u4e0d\u540c\u57df\u540d\uff0c\u53ea\u9700\u8981\u5c06\u5bf9\u5e94\u57df\u540d\u89e3\u6790\u5230frps\u670d\u52a1\u7aef\u7684\u670d\u52a1\u5668(IP)\u65e2\u53ef\u3002<br \/>\n\u4e5f\u652f\u6301\u6cdb\u89e3\u6790\u8bc6\u522b\uff0c\u4f8b\u5982\u5c06(demo.com)\u57df\u540d\u5df2\u7ecf\u6cdb\u89e3\u6790\u5230frps\u670d\u52a1\u7aef\u7684\u670d\u52a1\u5668(IP)<br \/>\n\u800c\u60f3\u901a\u8fc7(abc123.demo.com)\u8bbf\u95ee\u5230\u5bf9\u5e94\u7a7f\u900f\u670d\u52a1<br \/>\n\u5219\u5728\u5bf9\u5e94\u7a7f\u900f\u670d\u52a1\uff0ccustom_domains\u53c2\u6570\u4e2d\u586babc123.demo.com<\/p>\n<p>\u5206\u914d\u5bf9\u5e94\u7a7f\u900f\u5e94\u7528\u670d\u52a1\u552f\u4e00\u7684\u5b50\u57df\u540d\uff0c\u7528\u4e8e\u8bbf\u95ee<br \/>\nsubdomain = abc123<br \/>\n\u5047\u5982frps\u670d\u52a1\u7aef\u5df2\u7ecf\u914d\u7f6e\u4e86subdomain_host\u53c2\u6570\u57df\u540d\uff0c\u5e76\u4e14\u5df2\u7ecf\u6cdb(*)\u89e3\u6790\u5230frps\u670d\u52a1\u7aef\u7684\u670d\u52a1\u5668(VPS)IP\uff0c\u5219\u53ef\u4ee5\u4f7f\u7528\u6b64\u53c2\u6570\uff0c\u5426\u5219\u4e0d\u80fd\u7528\u3002<br \/>\n\u4f8b\u5982\u5df2\u7ecf\u6cdb\u89e3\u6790(demo.com)\u57df\u540d\u5e76\u4e14frps\u670d\u52a1\u7aef\u914d\u7f6e\u597d\u7684\uff0c\u4f7f\u7528\u6b64subdomain\u53c2\u6570\uff0c\u53ea\u9700\u8981\u586b\u5b50\u57df\u540d\uff0c\u800c\u4e0d\u9700\u8981\u586b(demo.com)<br \/>\nsubdomain = \u586babc123\uff0c\u5219\u53ef\u4ee5\u901a\u8fc7(abc123.demo.com)\u8bbf\u95ee<\/p>\n<p>\u4e3aHTTP\u534f\u8bae\uff0c\u6dfb\u52a0HTTP\u7528\u6237\u540d\u548c\u5bc6\u7801\u5b89\u5168\u8ba4\u8bc1<br \/>\nhttp_user = admin<br \/>\n\u81ea\u5b9a\u4e49\u7528\u6237\u540d<br \/>\nhttp_pwd = admin<br \/>\n\u81ea\u5b9a\u4e49\u5bc6\u7801<br \/>\n\u4ec5\u652f\u6301http,https\u7c7b\u578b\u534f\u8bae\u3002<br \/>\n\u4f8b\u5982\u6211\u7684WEB\u9875\u9762\uff0c\u8bbf\u95ee\u524d\uff0c\u9700\u8981\u8fdb\u884c\u9a8c\u8bc1\uff0c\u624d\u53ef\u4ee5\u8bbf\u95ee\u3002\u53ef\u4ee5\u6dfb\u52a0\u6b64\u53c2\u6570\u3002<\/p>\n<p>\u5b89\u5168\u5730\u66b4\u9732\u5185\u7f51\u670d\u52a1<br \/>\n\u5bf9\u4e8e\u67d0\u4e9b\u670d\u52a1\u6765\u8bf4\u5982\u679c\u76f4\u63a5\u66b4\u9732\u4e8e\u516c\u7f51\u4e0a\u5c06\u4f1a\u5b58\u5728\u5b89\u5168\u9690\u60a3\u3002<br \/>\nsk = abcdefg<br \/>\n\u53ef\u81ea\u5b9a\u4e49<br \/>\n\u6b64\u53c2\u6570\u7528\u4e8e\u8fdb\u4e00\u6b65\u9a8c\u8bc1\uff0c\u672c\u5730\u8bbf\u95ee\u7a7f\u900f\u670d\u52a1\u7684\u5b89\u5168\u8fde\u63a5\uff0c\u9700\u8981\u53cc\u65b9frpc\u5ba2\u6237\u7aef\u90fd\u9700\u8981\u914d\u7f6e\uff0c\u4ec5\u9002\u7528\u4e8estcp\u548cxtcp\u534f\u8bae\u7c7b\u578b\u3002<\/p>\n<p>frp\u66f4\u65b0\u4e86\u6700\u65b0\u7248\u76840.16.0\u7248\u672c\uff0c\u8fd9\u4e2a\u7248\u672c\u4e2d\u6dfb\u52a0\u4e86\u51e0\u9879\u65b0\u529f\u80fd\uff0c\u4e2a\u4eba\u89c9\u5f97\u6bd4\u8f83\u6709\u7528\u5904\u7684\u662fstatic_file\u6587\u4ef6\u670d\u52a1\u5668\u63d2\u4ef6\u548c\u7aef\u53e3\u8303\u56f4\u6620\u5c04\u8fd9\u4e24\u4e2a\u529f\u80fd\u3002\u8fd9\u91cc\u7279\u522b\u8bf4\u660e\u4e00\u4e0b<br \/>\nstatic_file\u6587\u4ef6\u670d\u52a1\u5668\u63d2\u4ef6\uff0c\u5bf9\u5916\u63d0\u4f9b\u7b80\u5355\u7684\u6587\u4ef6\u8bbf\u95ee\u670d\u52a1\u3002<br \/>\n[test_static_file]<br \/>\ntype = tcp<br \/>\nremote_port = 6000<br \/>\nplugin = static_file<br \/>\n# \u8981\u5bf9\u5916\u66b4\u9732\u7684\u6587\u4ef6\u76ee\u5f55<br \/>\nplugin_local_path = \/tmp\/file<br \/>\n# \u8bbf\u95ee url \u4e2d\u4f1a\u88ab\u53bb\u9664\u7684\u524d\u7f00\uff0c\u4fdd\u7559\u7684\u5185\u5bb9\u5373\u4e3a\u8981\u8bbf\u95ee\u7684\u6587\u4ef6\u8def\u5f84<br \/>\nplugin_strip_prefix = static<br \/>\nplugin_http_user = abc<br \/>\nplugin_http_passwd = abc<br \/>\n\u901a\u8fc7\u6d4f\u89c8\u5668\u8bbf\u95ee http:\/\/x.x.x.x:6000\/static\/ \u6765\u67e5\u770b\u4f4d\u4e8e \/tmp\/file \u76ee\u5f55\u4e0b\u7684\u6587\u4ef6\uff0c\u4f1a\u8981\u6c42\u8f93\u5165\u5df2\u8bbe\u7f6e\u597d\u7684\u7528\u6237\u540d\u548c\u5bc6\u7801\u3002<\/p>\n<p>\u8303\u56f4\u7aef\u53e3\u6620\u5c04\uff0c\u628afrp\u670d\u52a1\u5668\u7684\u90e8\u5206\u7aef\u53e3\u76f4\u63a5\u8f6c\u53d1\u7ed9\u5185\u7f51\u670d\u52a1\u5668<br \/>\n[range:test_tcp]<br \/>\ntype = tcp<br \/>\nlocal_ip = 127.0.0.1<br \/>\nlocal_port = 6000-6006,6007<br \/>\nremote_port = 6000-6006,6007<br \/>\n\u5b9e\u9645\u8fde\u63a5\u6210\u529f\u540e\u4f1a\u521b\u5efa 6 \u4e2a proxy\uff0c\u547d\u540d\u4e3a test_tcp_0, test_tcp_1 \u2026 test_tcp_5\u3002<\/p>\n<p>\u7b2c\u4e09\u6b65\uff1a\u542f\u52a8\u670d\u52a1<\/p>\n<p>linux\u73af\u5883\u4e0b\u542f\u52a8\u670d\u52a1\uff0c\u9700\u8981\u5148\u628a\u8fd0\u884c\u6587\u4ef6\u6dfb\u52a0\u53ef\u6267\u884c\u6743\u9650\u3002\u4f8b\u5982\u6211\u7684\u6587\u4ef6\u5b9e\u5728root\u6587\u4ef6\u5939\u4e2d\uff0c\u6211\u9700\u8981\u642d\u5efafrp\u670d\u52a1\u7aef\uff0c\u90a3\u4e48\u5f85\u8bbe\u7f6e\u597d\u670d\u52a1\u7aef\u914d\u7f6e\u6587\u4ef6\uff08frps.ini\uff09\u540e\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\u5373\u53ef\u3002<br \/>\ncd \/root<br \/>\nchmod +x frps<br \/>\nnohup .\/frps -c .\/frps.ini &amp;<br \/>\n\u6267\u884c\u6210\u529f\u540e\uff0c\u4f1a\u663e\u793afrp\u7684\u8fdb\u7a0b\u53f7\u7801\u3002\u4f60\u4e5f\u53ef\u4ee5\u901a\u8fc7\u547d\u4ee4\u6765\u67e5\u770bfrps\u8fd0\u884c\u7684\u8fdb\u7a0b\u7f16\u53f7\u3002<br \/>\nps -e | grep frps<\/p>\n<p>\u5728windows\u73af\u5883\u4e0b\u5219\u662f\u4ee5\u7ba1\u7406\u5458\u8eab\u4efd\u8fd0\u884ccmd\u547d\u4ee4\u63d0\u793a\u7b26\u3002\u8fdb\u5165\u76f8\u5e94\u7684\u76ee\u5f55\u540e\uff0c\u8fd0\u884c\u547d\u4ee4\u5373\u53ef\u3002<br \/>\nfrps -c frps.ini &amp;<\/p>\n<p>\u5173\u4e8efrp\u7ba1\u7406\u7684\u4f18\u5316\u8bbe\u7f6e<\/p>\n<p>debian8.0\uff0c\u6216\u8005\u662fcentos7.0\u4ee5\u4e0a\u7684\u7248\u672c\uff0c\u670d\u52a1\u90fd\u662f\u57fa\u4e8esystemd\u7684\u65b9\u5f0f\u8fdb\u884c\u7ba1\u7406\u7684\u3002frp\u901a\u8fc7\u8bbe\u7f6e\u540e\u4e5f\u53ef\u4ee5\u5b9e\u73b0systemd\u7684\u65b9\u5f0f\u8fdb\u884c\u7ba1\u7406\uff0c\u8fd9\u6837\u6211\u4eec\u5c31\u53ef\u4ee5\u901a\u8fc7systemctl\u547d\u4ee4\u6765\u8fdb\u884c\u670d\u52a1\u7684\u7edf\u4e00\u7ba1\u7406\uff0c\u540c\u65f6\u901a\u8fc7\u8fd9\u6837\u7684\u8bbe\u7f6e\u4e5f\u53ef\u4ee5\u5c06frp\u670d\u52a1\u52a0\u5165\u5f00\u673a\u81ea\u542f\u52a8\u3002<\/p>\n<p>1\u3001\u5c06frp\u8bbe\u7f6e\u6210linux\u7cfb\u7edf\u7684\u670d\u52a1\uff0c\u57fa\u4e8esystemd\u65b9\u5f0f\u7ba1\u7406<\/p>\n<p># \u7f16\u5199 frp service \u6587\u4ef6\uff0c\u4ee5 centos7 \u4e3a\u4f8b<br \/>\nvim \/usr\/lib\/systemd\/system\/frps.service<br \/>\n# \u5185\u5bb9\u5982\u4e0b<\/p>\n<p>[Unit]<br \/>\nDescription=frps daemon<br \/>\nAfter=syslog.target network.target<br \/>\nWants=network.target<\/p>\n<p>[Service]<br \/>\nType=simple<br \/>\nExecStart=\/root\/frp\/frps -c \/root\/frp\/frps.ini<br \/>\nRestart=always<br \/>\nRestartSec=1min<\/p>\n<p>[Install]<br \/>\nWantedBy=multi-user.target<\/p>\n<p>2\u3001\u5c06frp\u8bbe\u7f6e\u6210\u5f00\u673a\u81ea\u542f\u52a8<br \/>\nsystemctl enable frps<br \/>\nsystemctl restart frps<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u5173\u4e8efrp\u5185\u7f51\u7a7f\u900f\u7684\u57fa\u672c\u6559\u7a0b\u4e86\uff0c\u642d\u5efa\u53ef\u4ee5\u5c1d\u8bd5\u7167\u7740\u6559\u7a0b\u642d\u5efa\u4e00\u4e0b\uff0c\u5982\u679c\u8fd8\u6709\u4e0d\u61c2\u7684\u5730\u65b9\u6b22\u8fce\u52a0\u5165\u7ef4\u7b80\u7f51\u4ea4\u6d41\u7fa4\u8fdb\u884c\u4ea4\u6d41\u3002\u8f6c\u81f3http:\/\/www.xyzbeta.com\/460<\/p>\n<p>Debian7+ X64\u3000\u81ea\u542f\u52a8\u65b9\u6cd5<br \/>\n\u4f7f\u7528supervisor\u5b88\u62a4\u8fdb\u7a0b\uff0c\u6765\u8ba9frps\u5f00\u673a\u81ea\u542f\u3001\u5954\u6e83\u91cd\u542f\u3001\u540e\u53f0\u8fd0\u884c\u3002<br \/>\n\u5b89\u88c5<br \/>\napt-get install -y supervisor<br \/>\n    \u7531\u4e8e\u4e0a\u9762\u5b89\u88c5\u547d\u4ee4\u5b89\u88c5\u4e86\uff0c\u6211\u4eec\u53ea\u9700\u8981\u6dfb\u52a0\u4e00\u4e2asupervisor\u914d\u7f6e\u6587\u4ef6\uff0c\u6765\u5b88\u62a4frp\u8fdb\u7a0b\u3002<\/p>\n<p>    \u521b\u5efa\u5b88\u62a4\u8fdb\u7a0b\u6587\u4ef6<\/p>\n<p>    touch \/etc\/supervisor\/conf.d\/frps.conf<\/p>\n<p>    \u7f16\u8f91\u6587\u4ef6<\/p>\n<p>    vi \/etc\/supervisor\/conf.d\/frps.conf<\/p>\n<p>#\u6dfb\u52a0\u4ee5\u4e0b\u53c2\u6570<\/p>\n<p>[program:frps]<br \/>\nuser=root<br \/>\ncommand=\/root\/frp16\/frps -c \/root\/frp16\/frps.ini<br \/>\nstartsecs=1<br \/>\nstartretries=100<br \/>\nautorstart=true<br \/>\nautorestart=true<br \/>\nstderr_logfile=\/tmp\/err-frps.log<br \/>\nstderr_logfile_maxbytes=50MB<br \/>\nstderr_logfile_backups=10<br \/>\nstdout_logfile=\/tmp\/out-frps.log<br \/>\nstdout_logfile_maxbytes=50MB<br \/>\nstdout_logfile_backups=10<\/p>\n<p>    \u4fdd\u5b58\u540e\uff0c\u9700\u8981\u5bf9supervisor\u8fdb\u884c\u66f4\u65b0<\/p>\n<p>    \u547d\u4ee4\uff1asupervisorctl update all<\/p>\n<p>    \u542f\u52a8\uff08\u9996\u6b21\u4f7f\u7528\uff0c\u8bf7\u6267\u884c\u4e00\u6b21\uff09<\/p>\n<p>    supervisorctl start frps<\/p>\n<p>    \u91cd\u542f<\/p>\n<p>    supervisorctl restart frps<\/p>\n<p>    \u505c\u6b62<\/p>\n<p>    supervisorctl stop frps<\/p>\n<p>    \u7531\u4e8efrps\u5bf9\u65f6\u95f4\u8fdb\u884c\u9a8c\u8bc1\uff0c\u6240\u4ee5\u4f60\u7684\u5f53\u524d\u673a\u5668\u65f6\u95f4\u6700\u597d\u540c\u6b65\u5317\u4eac\u65f6\u95f4\u4e3a\u51c6\uff0c\u4e0a\u9762\u8981\u5b89\u88c5apt-get install -y wget ntpdate\u3002\u6211\u4eec\u9700\u8981\u5bf9\u672c\u673a\u5668\u8fdb\u884c\u66f4\u65b0\u6821\u5bf9\u3002<\/p>\n<p>    \u547d\u4ee4\uff1a\/usr\/sbin\/ntpdate 0.cn.pool.ntp.org<\/p>\n<p>    \u6216\u8005\u6dfb\u52a0\u5b9a\u65f6\u4efb\u52a1\uff0c\u6bcf\u5929\u6267\u884c\u4e00\u6b21\u65f6\u95f4\u6821\u5bf9\u3002<\/p>\n<p>    crontab -e<\/p>\n<p>    30 5 * * * \/usr\/sbin\/ntpdate 0.cn.pool.ntp.org<\/p>\n<p>    \u7279\u522b\u6ce8\u610f\u4f60\u5f53\u524d\u7684\u673a\u5668\u9632\u706b\u5899\uff0cfrps.ini\u91cc\u6240\u4f7f\u7528\u5230\u7684\u7aef\u53e3\uff0c\u90fd\u9700\u8981\u5f00\u653e\uff0ctcp\u548cudp\u534f\u8bae\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Frp\u57fa\u672c\u4fe1\u606f frp\u5168\u540dFast Reverse Proxy\uff0c\u662f\u7528\u4e8e\u63d0\u4f9b\u5185\u7f51\u7a7f\u900f\u670d\u52a1\u7684\u5de5\u5177\uff0c\u4e3b\u8981\u7528\u4e8e\u89e3\u51b3\u4e00\u4e9b [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[5],"tags":[25,21,24],"_links":{"self":[{"href":"https:\/\/kkong.net\/index.php?rest_route=\/wp\/v2\/posts\/153"}],"collection":[{"href":"https:\/\/kkong.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kkong.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kkong.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kkong.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=153"}],"version-history":[{"count":4,"href":"https:\/\/kkong.net\/index.php?rest_route=\/wp\/v2\/posts\/153\/revisions"}],"predecessor-version":[{"id":168,"href":"https:\/\/kkong.net\/index.php?rest_route=\/wp\/v2\/posts\/153\/revisions\/168"}],"wp:attachment":[{"href":"https:\/\/kkong.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=153"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kkong.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=153"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kkong.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=153"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}