写一下最近2天使用frp过程中所踩的坑。
下载安装
https://github.com/fatedier/frp
当前最新0.38版 https://github.com/fatedier/frp/releases/download/v0.38.0/frp_0.38.0_linux_amd64.tar.gz
一路配置,访问结果报错了,然后翻了好几篇文档,从开始的假域名,到最后上了一个真域名,做了解析,还是报类似错误。
界面报错
The page you requested was not found.
Sorry, the page you are looking for is currently unavailable.
Please try again later.
The server is powered by frp.
Faithfully yours, frp.
日志报错
2022/01/24 07:25:21 [W] [http.go:92] do http proxy request error: no such domain: ******xyz /
测试了一下端口7000,通畅的,问题不在这里。
怀疑 frpc.ini 里面的 域名格式错误,前后空格问题。。。。
解决
修改frpc.ini 后,再次启动,发现问题 了 7000端口明明被我改成7567了,咋还是这个?
# ./frps -c frpc.ini
2022/01/24 16:04:19 [I] [root.go:200] frps uses config file: frpc.ini
2022/01/24 16:04:19 [I] [service.go:192] frps tcp listen on 0.0.0.0:7000
2022/01/24 16:04:19 [I] [root.go:209] frps started successfully
猛然想起,我执行的是frps,服务端,应该跑frpc 客户端程序呀,太囧了,折腾了2天,一直怀疑端口问题,语法问题,谁知道是启动命令问题。
正确的打开方式,日志中有了某某服务代理成功。
# ./frpc -c frpc.ini
2022/01/24 16:07:19 [I] [service.go:301] [6538fbc408cebb03] login to server success, get run id [6538fbc408cebb03], server udp port [0]
2022/01/24 16:07:19 [I] [proxy_manager.go:144] [6538fbc408cebb03] proxy added: [dcs dcs_admin ssh]
2022/01/24 16:07:19 [I] [control.go:180] [6538fbc408cebb03] [dcs] start proxy success
2022/01/24 16:07:19 [I] [control.go:180] [6538fbc408cebb03] [dcs_admin] start proxy success
2022/01/24 16:07:19 [I] [control.go:180] [6538fbc408cebb03] [ssh] start proxy success
最终界面
还有一些报错应是网络问题,有空再看,记录在这里
2022/01/24 16:09:56 [E] [control.go:158] [1acf29f9337e28d0] work connection closed before response StartWorkConn message: EOF
2022/01/24 16:10:07 [W] [service.go:177] [1acf29f9337e28d0] reconnect to server error: i/o deadline reached
配置
再贴一下frps.ini 以及 frpc.ini 配置,以免今后用的上。
frps.ini 如下:
cat frps.ini
[common]
bind_port = 7567
dashboard_port = 7500
token = faketoken
dashboard_user = admin
dashboard_pwd = fakepassword
vhost_http_port = 8080
vhost_https_port = 4433
log_file = /var/log/frps.log
log_level = info
frpc.ini如下:
cat frpc.ini
[common]
server_addr = yourip
server_port = 7567
token = faketoken
log_file = /var/log/frpc.log
log_level = info
[web]
type = http
local_ip = 10.60.2.19
local_port = 80
custom_domains = dce.域名星号.xyz
[dce_reg_80]
type = http
local_ip = 10.60.2.20
local_port = 80
custom_domains = dcer.域名星号.xyz
[dsp]
type = http
#local_ip = 127.0.0.1
local_port = 38183
custom_domains = dsp.域名星号.xyz
[ssh1]
type = tcp
local_ip = 127.0.0.1
local_port = 22
remote_port = 7006
补充一下自签证书的https代理
增加如下配置
[test_https2http]
type = https
custom_domains = abc.域名星号.xyz
plugin = https2http
plugin_local_addr = 10.60.2.19:443
plugin_crt_path = /tmp/ssl/front-proxy-ca.crt
plugin_key_path = /tmp/ssl/front-proxy-ca.key
plugin_host_header_rewrite = 127.0.0.1
plugin_header_X-From-Where = frp
https访问效果
2022-02-21继续补充配置,把frp改成服务来调用,据说可以减少一些报错。
- 服务器这边配置如下
cat /usr/lib/systemd/system/frps.service
[Unit]
Description=frps service
After=network.target syslog.target
Wants=network.target
[Service]
Type=simple
#启动服务的命令(此处写你的frp的实际安装目录)
ExecStart=/root/frp/frps -c /root/frp/frps.ini
[Install]
WantedBy=multi-user.target
然后
systemctl daemon-reload
systemctl start frps
systemctl status frps -l
- 客户端这边配置如下
cat /usr/lib/systemd/system/frpc.service
[Unit]
Description=frpc service
After=network.target syslog.target
Wants=network.target
[Service]
Type=simple
ExecStart=/root/app/frp_0.38.0_linux_amd64/frpc -c /root/app/frp_0.38.0_linux_amd64/frpc.ini
[Install]
WantedBy=multi-user.target
同样
systemctl daemon-reload
systemctl start frps
systemctl status frps -l
文章评论
https内网穿透不用加SSL证书吗?
我不加证书不行呢
@皇家元林 https内网穿透要用插件https2http,要填证书地址的,我补充了一下文档,你可以试试。