frp内网穿透初探

frp内网穿透

https://github.com/fatedier/frp/blob/master/README_zh.md

1、公网ip(云服务器一台)

2、内网服务器一台(个人电脑)

3、域名(可选)

4、frp(分为客户端和服务器端)

服务器搭建在公网上,以下操作为阿里云服务器

a.先查看linux版本信息

cat /proc/version
cat /proc/version 
cat /proc/version
Linux version 3.10.0-1062.4.1.el7.x86_64 (mockbuild@kbuilder.bsys.centos.org)
Linux version 3.10.0-1062.4.1.el7.x86_64 (mockbuild@kbuilder.bsys.centos.org) 
Linux version 3.10.0-1062.4.1.el7.x86_64 (mockbuild@kbuilder.bsys.centos.org)

b.创建文件夹

<span class="token function">cd</span> /home <span class="token function">mkdir</span> frp <span class="token function">cd</span> frp
<span class="token function">cd</span> /home <span class="token function">mkdir</span> frp <span class="token function">cd</span> frp 
cd /home mkdir frp cd frp

c.下载frp

wget https://github.com/fatedier/frp/releases/download/v0.31.2/frp_0.31.2_linux_386.tar.gz
wget https://github.com/fatedier/frp/releases/download/v0.31.2/frp_0.31.2_linux_386.tar.gz 
wget https://github.com/fatedier/frp/releases/download/v0.31.2/frp_0.31.2_linux_386.tar.gz

d.解压文件

<span class="token function">tar</span> xvf frp_0.31.2_linux_386.tar.gz
<span class="token function">tar</span> xvf frp_0.31.2_linux_386.tar.gz 
tar xvf frp_0.31.2_linux_386.tar.gz

e.进入文件

cd frp_0.31.2_linux_386
cd frp_0.31.2_linux_386 
cd frp_0.31.2_linux_386

a.编辑配置文件frps.ini

vim frps.ini
vim frps.ini 
vim frps.ini
<span class="token punctuation">[</span>common<span class="token punctuation">]</span> bind_port <span class="token operator">=</span> 7000 vhost_http_port <span class="token operator">=</span> 80
<span class="token punctuation">[</span>common<span class="token punctuation">]</span> bind_port <span class="token operator">=</span> 7000 vhost_http_port <span class="token operator">=</span> 80 
[common] bind_port = 7000 vhost_http_port = 80

b.wq保存退出,启动服务

./frps -c ./frps.ini
./frps -c ./frps.ini 
./frps -c ./frps.ini

c.出现以下结果,说明启动成果

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-A8PsmrVz-1582513090297)(/Users/bobwang/Library/Application Support/typora-user-images/image-20200210224331237.png)]

1)下载跟服务器端版本一致的frp

frp_0.31.2_darwin_amd64.tar.gz
frp_0.31.2_darwin_amd64.tar.gz 
frp_0.31.2_darwin_amd64.tar.gz

2)解压后进入文件配置frps.ini

<span class="token function">cd</span> frp_0.31.2_darwin_amd64 vim frpc.ini
<span class="token function">cd</span> frp_0.31.2_darwin_amd64 vim frpc.ini 
cd frp_0.31.2_darwin_amd64 vim frpc.ini

我的配置为

<span class="token punctuation">[</span>common<span class="token punctuation">]</span> server_addr <span class="token operator">=</span> xxx.xxx.xxx.xxx server_port <span class="token operator">=</span> 7000 <span class="token punctuation">[</span>web<span class="token punctuation">]</span> <span class="token function">type</span> <span class="token operator">=</span> http local_port <span class="token operator">=</span> 8080 custom_domains <span class="token operator">=</span> xxx.xxx.xxx.xxx
 <span class="token punctuation">[</span>common<span class="token punctuation">]</span> server_addr <span class="token operator">=</span> xxx.xxx.xxx.xxx server_port <span class="token operator">=</span> 7000 <span class="token punctuation">[</span>web<span class="token punctuation">]</span> <span class="token function">type</span> <span class="token operator">=</span> http local_port <span class="token operator">=</span> 8080 custom_domains <span class="token operator">=</span> xxx.xxx.xxx.xxx 
[common] server_addr = xxx.xxx.xxx.xxx server_port = 7000 [web] type = http local_port = 8080 custom_domains = xxx.xxx.xxx.xxx

3)wq退出保存,启动服务

./frpc -c ./frpc.ini
./frpc -c ./frpc.ini 
./frpc -c ./frpc.ini

简书:https://www.jianshu.com/p/5f7e71121a4f

个站:https://www.newlearner.site/2018/12/12/frp-mac.html

知乎:https://zhuanlan.zhihu.com/p/45445979

暂时未能解决 nginx反向代理frp服务器端的问题,只能单独开启端口

原文链接:https://blog.csdn.net/Bobdragery/article/details/104473745

© 版权声明
THE END
喜欢就支持一下吧
点赞0 分享