一般配置

; frps.ini
[common]
bind_port = 7000
token = <token>
vhost_http_port = 8080

dashboard_port = 7900
dashboard_user = <user>
dashboard_pwd = <pwd>
; frpc.ini
[common]
server_addr = <ip_addr>
server_port = 7000
token = <token>

[ssh]
type = tcp
local_ip = 127.0.0.1
local_port = 22
remote_port = 6000

; 让外网可以访问到内网的某个 Web 服务
[web]
type = http
local_ip = 127.0.0.1
local_port = 80
custom_domains = <domain>

; Remote Desktop Protocol
[rdp]
type = tcp
local_ip = 127.0.0.1
local_port = 3389
remote_port = 3389

stcp

上面 tcp 仅需要 vps 配置好 fprs 客户端使用 frpc 连接就好。而 stcp 多了一步验证,vps 中的 frps.ini 配置还是和上面相同

访问端—vps—服务端

; B: 被访问的机器 frpc.ini
[secret_ssh]
type = stcp
role = server
sk = <secret_key>
local_ip = 127.0.0.1
local_port = 22
; A: 访问者的 frpc.ini
[secret_ssh_visitor]
type = stcp
role = visitor
server_name = secret_ssh
sk = <secret_key>
bind_addr = 127.0.0.1
bind_port = 6000

设为启动项

  1. 将 frp 软件目录 systemd 文件夹下对应的配置文件放入/etc/systemd/system/
  2. 并修改配置文件中的路径
  3. systemctl enable 添加自启
    systemctl disable 取消自启