内容目录

安装frp

下载frp二进制文件。所有的文件都打包在一个压缩包中
加速下载wget https://mirror.ghproxy.com/https://github.com/fatedier/frp/releases/download/v0.61.0/frp_0.61.0_linux_amd64.tar.gz

  • 服务端(腾讯云)配置:

    • 解压:tar xf frp_0.61.0_linux_amd64.tar.gz -C /etc
    • 创建软链接:ln -s /etc/frp_0.61.0_linux_amd64/ /etc/frp
    • 使用systemd来管理frps服务
      vim /usr/lib/systemd/system/frps.service
      [Unit]
      # 服务名称,可自定义
      Description = frp server
      After = network.target syslog.target
      Wants = network.target
      [Service]
      Type = simple
      # 启动frps的命令,需修改为您的frps的安装路径
      ExecStart = /etc/frp/frps -c /etc/frp/frps.toml
      [Install]
      WantedBy = multi-user.target
    • 使用systemctl命令管理frps服务
      # 启动frps
      systemctl start frps
      # 开机自启动
      systemctl enable frps
      # 重启frps
      systemctl restart frps
      # 查看frps状态
      systemctl status frps
  • 内网web业务主机配置:

    • 解压:tar xf frp_0.61.0_linux_amd64.tar.gz -C /etc
    • 创建软链接:ln -s /etc/frp_0.61.0_linux_amd64/ /etc/frp
    • 使用systemd来管理frpc服务
      vim /usr/lib/systemd/system/frpc.service
      [Unit]
      # 服务名称,可自定义
      Description = frp server
      After = network.target syslog.target
      Wants = network.target
      [Service]
      Type = simple
      # 启动frpc的命令,需修改为您的frpc的安装路径
      ExecStart = /etc/frp/frpc -c /etc/frp/frpc.toml
      [Install]
      WantedBy = multi-user.target
    • 使用systemctl命令管理frpc服务
      # 启动frpc
      systemctl start frpc
      # 开机自启动
      systemctl enable frpc
      # 重启frpc
      systemctl restart frpc
      # 查看frpc状态
      systemctl status frpc

通过自定义域名访问内网的 Web 服务

  • 配置frps.toml:在 frps.toml 文件中添加以下内容,以指定 HTTP 请求的监听端口为80

    vim /etc/frp/frps.toml
    bindPort = 7000
    vhostHTTPPort = 80
  • 配置frpc.toml:在 frpc.toml 文件中添加以下内容,确保设置了正确的服务器 IP 地址、本地 Web 服务监听端口和自定义域名:

    vim /etc/frp/frpc.toml
    serverAddr = "x.x.x.x"
    serverPort = 7000
    [[proxies]]
    name = "web"
    type = "http"
    localPort = 80
    customDomains = ["x.com.cn"]
  • 通过浏览器访问:使用浏览器访问 x.com.cn 即可访问内网机器上的 80 端口服务

内网穿透(远程桌面)

  1. 下载frp_0.64.0_windows_amd64.zip
  2. 将下载的压缩包解压到任意目录,例如 C:\frp
  3. 配置frpc.toml
serverAddr = "x.x.x.x"
serverPort = 7000

[[proxies]]
name = "rdp"
type = "tcp"
localIP = "127.0.0.1"
localPort = xxx
remotePort = xxx
  1. 运行客户端,cd C:\frp,然后frpc.exe -c frpc.toml
最后修改日期: 2025年8月18日

留言

撰写回覆或留言

发布留言必须填写的电子邮件地址不会公开。