以下内容为原创,转载请注明出处!


客户端环境

  • 本地服务器CentOS Linux release 7.2.1511 (Core) 


服务器环境

  • 华为云服务器CentOS Linux release 7.2.1511 (Core) ,有公网IP(必须)


使用步骤:

1、选择对应的版本下载,我直接下载最新版本,链接:https://github.com/fatedier/frp/releases

2、将frpc开头的相关文件放到客户端上,修改frpc.ini文件,添加如下,具体文档可以参考:https://gofrp.org/docs/overview/

[common]
server_addr = 121.36.xxx.xxx    # 服务器地址
server_port = 7000              # 服务器frps.ini配置ip

[camera_web]                    # 这里将摄像头后台服务用20053映射出来
type = tcp
local_ip = 192.168.10.xx
local_port = 80
remote_port = 20053

[camera]                        # 这里将摄像头rtsp服务的554端口用5541映射出来
type = tcp
local_ip = 192.168.10.xx
local_port = 554
remote_port = 5541

[web]
type = tcp
local_ip = 192.168.10.xx
local_port = 18080
remote_port = 20052

[ssh]                            # 将ssh权限穿透出来
type = tcp
local_ip = 127.0.0.1
local_port = 22
remote_port = 6000

3、将frps开头的相关文件放到带有公网的服务端,修改frps.ini文件,添加如下,具体文档可以参考:https://gofrp.org/docs/overview/

[common]
bind_port = 7000                # 监听7000端口,ip默认为服务器当前ip

4、启动服务:先启动服务端,再启动客户端。如果需要在后台长期运行,建议结合其他工具使用,例如 systemd 和 supervisor。

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

5、访问即可