{"id":215453,"date":"2021-04-18T00:36:40","date_gmt":"2021-04-17T16:36:40","guid":{"rendered":"https:\/\/lrxjmw.cn\/?p=215453"},"modified":"2021-04-18T00:35:16","modified_gmt":"2021-04-17T16:35:16","slug":"self-make-frp","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/self-make-frp.html","title":{"rendered":"\u4fee\u6539FRP\u9ed8\u8ba4\u7684http404\u9875\u9762\u540e\u81ea\u884c\u7f16\u8bd1"},"content":{"rendered":"\n\n\n
\u5bfc\u8bfb<\/td>\nfrp\u5728\u505a\u7f51\u7ad9\u8f6c\u53d1\u7684\u65f6\u5019\uff0c\u5176\u9ed8\u8ba4\u7684404\u9875\u9762\u4e0a\u7684\u6587\u5b57\u5e26\u6709frp\u7684\u94fe\u63a5\uff0c\u95f4\u63a5\u5f97\u66b4\u6f0f\u670d\u52a1\u5668\u4f7f\u7528frp\uff0c\u53ef\u80fd\u4f1a\u5bfc\u81f4\u5176\u4ed6\u7aef\u53e3\u88ab\u626b\u63cf\u7206\u7834\u3002\u8fd9\u6837\u9ebb\u70e6\u80fd\u907f\u514d\u6700\u597d\u3002\u6211\u4eec\u53ef\u4ee5\u4e0b\u8f7d\u6e90\u7801\uff0c\u81ea\u884c\u4fee\u6539404\u9875\u9762\u4e4b\u540e\u91cd\u65b0\u7f16\u8bd1frp<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n

\"\"<\/p>\n

\u914d\u7f6eGo\u73af\u5883<\/strong><\/div>\n
\u5b89\u88c5\u4f9d\u8d56<\/strong><\/span><\/div>\n
# Ubuntu\r\n$ sudo apt-get install bison ed gawk gcc libc6-dev make\r\n# CentOS\r\n$ sudo yum install gcc\r\n<\/pre>\n
\u4e0b\u8f7d\u5b89\u88c5Go<\/strong><\/span><\/div>\n

Golang\u5404\u7248\u672c\u7684\u4e0b\u8f7d\u5730\u5740 https:\/\/golang.org\/dl\/<\/p>\n

# \u4e0b\u8f7d\u5f53\u524d\u6700\u65b0\u7248\u7684\r\n$ wget https:\/\/golang.org\/dl\/go1.16.2.linux-amd64.tar.gz\r\n# \u89e3\u538b\u5230\/usr\/local\r\n$ sudo tar -C \/usr\/local -xzf go1.16.2.linux-amd64.tar.gz\r\n<\/pre>\n
# \u6dfb\u52a0\u73af\u5883\u53d8\u91cf\r\n$ vim \/etc\/profile\r\n\u5728\u6587\u4ef6\u7684\u5e95\u90e8\u6dfb\u52a0\u4ee5\u4e0b\u4e24\u884c\uff1a\r\nexport PATH=$PATH:\/usr\/local\/go\/bin\r\nexport GOPATH=\/usr\/local\/gopath\r\n:wq \u4fdd\u5b58\u9000\u51fa\u540e\uff0c\u91cd\u65b0\u52a0\u8f7dprofile\u6587\u4ef6\r\n$ source \/etc\/profile\r\n<\/pre>\n

\u6d4b\u8bd5Go\u73af\u5883\uff0c\u6709\u8f93\u51fa\u5373\u53ef<\/p>\n

$ go version\r\n<\/pre>\n
\u4e0b\u8f7d\u4fee\u6539frp<\/strong><\/div>\n
\u4e0b\u8f7dfrp<\/strong><\/span><\/div>\n

\u901a\u8fc7go get\u4e0b\u8f7dfrp\u7684\u6e90\u7801<\/p>\n

$ go get github.com\/fatedier\/frp<\/pre>\n

go get\u662f\u9ed8\u8ba4\u4e0b\u8f7d\u5230go\u73af\u5883\u7684gopath\u76ee\u5f55\u4e0b\u9762.\u5f53\u524d\u6700\u65b0frp\u662fv0.36.2\uff0c\u5982\u679cfrp\u6709\u7248\u672c\u53f7\u66f4\u65b0\u53ef\u4ee5\u81ea\u884c\u5230\u8fdb\u5165\u5230\u76ee\u5f55<\/p>\n

$ cd \/usr\/local\/gopath\/pkg\/mod\/github.com\/fatedier\/frp@v0.36.2<\/pre>\n

frp \u7684http 404\u9875\u9762\u5199\u6b7b\u5728frp\u76ee\u5f55\u7684pkg\/util\/vhost\/resource.go\u6587\u4ef6\u91cc<\/p>\n

$ cd \/usr\/local\/gopath\/pkg\/mod\/github.com\/fatedier\/frp@v0.36.2\/pkg\/util\/vhost\r\n$ vi resource.go<\/pre>\n

\u5728resource.go\u6587\u4ef6\u91cc\u9762\u7684const\u8fd9\u8282\uff0c\u53ef\u4ee5\u5f88\u6e05\u695a\u770b\u5230http 404\u7684html\u914d\u7f6e\uff0c\u505a\u4e00\u4e0b\u7b80\u5355\u7684\u4fee\u6539\uff0c\u53bb\u6389\u80fd\u66b4\u9732\u51fa\u6765\u7684frp\u7684\u6807\u8bc6\u3002
\n\u539f\u6587\u4ef6\u5185\u5bb9\u662f
\n\"\"<\/p>\n

\u6839\u636e\u9700\u6c42\u7b80\u5355\u4fee\u6539
\n\"\"
\n:wq! \u5f3a\u5236\u4fee\u6539\u4fdd\u5b58\u9000\u51fa<\/p>\n

\u91cd\u65b0\u7f16\u8bd1<\/strong><\/div>\n

\u4fee\u6539\u5b8c\u6587\u4ef6\uff0c\u8fd4\u56de\u5230frp\u76ee\u5f55<\/p>\n

$ cd \/usr\/local\/gopath\/pkg\/mod\/github.com\/fatedier\/frp@v0.36.2\r\n$ make\r\n<\/pre>\n

\u7a0d\u7b49\u4e00\u4f1a\uff0c\u4f1a\u6709\u4e00\u5806\u8f93\u51fa\u3002\u7f16\u8bd1\u5b8c\u4e4b\u540e\uff0cfrpc\u548cfrps\u5728fatedier\/frp@v0.36.2\/bin\u76ee\u5f55\u91cc<\/p>\n

\"\"\"\"<\/p>\n

$ cd \/usr\/local\/gopath\/pkg\/mod\/github.com\/fatedier\/frp@v0.36.2\/bin<\/pre>\n

\u56e0\u4e3a\u6211\u4eec\u53ea\u9700\u8981\u4fee\u6539frps\u7684404\u9875\u9762\uff0c\u66ff\u6362\u7f16\u8bd1\u597d\u7684frps\u5c31\u884c\u4e86\u3002frp\u5728\u6709http 404\u9519\u8bef\u5c31\u662f\u6211\u4eec\u4fee\u6539\u8fc7\u7684\u9875\u9762<\/p>\n

\"\"<\/p>\n","protected":false},"excerpt":{"rendered":"

# Ubuntu $ sudo apt-get install bison ed gawk gcc libc6 […]<\/p>\n","protected":false},"author":362,"featured_media":215837,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-215453","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/215453","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/362"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=215453"}],"version-history":[{"count":21,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/215453\/revisions"}],"predecessor-version":[{"id":215904,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/215453\/revisions\/215904"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/215837"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=215453"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=215453"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=215453"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}