Contents

frp

resource

stcp

将本地的ssh服务映射出去的话,适合用这种类型的。安全系数更高。

proxy

1
2
3
4
5
6
7
8
9
[[proxies]]
name = "ssh-a"
type = "stcp"
secretKey = "{{ .Envs.FRP_VISTOR_KEY }}"
localIP = "127.0.0.1"
localPort = 22
# If not empty, only visitors from specified users can connect.
# Otherwise, visitors from same user can connect. '*' means allow all users.
# allowUsers = ["*"]

vistor

  • name, serverName, secretKey 三者要与proxy对应
    1
    2
    3
    4
    5
    6
    7
    8
    
       [[visitors]]
       name = "ssh-a"
       type = "stcp"
       serverName = "ssh-a"
       secretKey = "{{ .Envs.FRP_VISTOR_KEY }}"
       bindAddr = "127.0.0.1"
       bindPort = 5000
    #serverUser = "user"
    
  • ssh 的话,可以在 ~/.ssh/config 中添加如下配置,方便访问
    1
    2
    3
    4
    5
    6
    7
    8
    
    Host fp-xx
      HostName 127.0.0.1
      Port 5000
      User root
      ServerAliveInterval 60
      StrictHostKeyChecking no
      # 需要被穿透的机器
      #IdentityFile  ~/.ssh/public.key
    

tcp

将本地的一些服务映射出去的话,适合这种的类型。像数据库之类的,其本身带了权限验证。

proxy

  • url: {frps.addr} + {remotePort}
1
2
3
4
5
6
[[proxies]]
name = "mysql-service"
type = "tcp"
localIP = "127.0.0.1"
localPort = 3306
remotePort = 13306

http

  • http 服务 这里的访问地址是proxy配置中的 subdomain + {frp server}中的 subDomainHost + {frp server} 中的 vhostHTTPPort 域名访问可能会转的备案页面.
    1
    2
    3
    4
    5
    6
    7
    
    [[proxies]]
    name = "test"
    type = "http"
    localIP = "127.0.0.1"
    localPort = 7000
    subdomain = "test-"
    locations = ["/", "/ng_check"]
    
  • static files 提供简单的用户名、密码校验
     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    
    [[proxies]]
    name = "static-file"
    type = "tcp"
    remotePort = 7104
    [proxies.plugin]
    type = "static_file"
    # 本地文件目录,对外提供访问
    localPath = "/data/workspace/web/docs"
    # URL 中的前缀,将被去除,保留的内容即为要访问的文件路径
    stripPrefix = "blog"
    httpUser = "abc"
    httpPassword = "abc"