frp反向代理

官方 https://github.com/fatedier/frp/releases
服务器端选择 64位linux linux_amd64.tar.gz
客户端选windows64位 windows_amd64.zip

  • 服务器
    服务器端只需要两个文件frps和frps.ini
    解压到根目录下 frp文件夹 通过cd进入frp,进入目录执行,注意权限改为777
    cd frp 进入目录
    nohup ./frps -c ./frps.toml & 一般启动命令,用进程管理程序更好,异常关闭自动重启

    frps.toml 服务器配置

    bindPort = 4433 #服务端监听地址, 默认7000
    vhostHTTPPort = 8081 #http代理端口
    vhostHTTPSPort = 8082 #https代理端口
    subDomainHost = "api.shanliwawa.top" #二级域名配置
    webServer.addr = "0.0.0.0"
    webServer.port = 7500
    webServer.user = "admin"
    webServer.password = "111"
    frp客户端启动,创建frp服务.bat文件.服务启动net start frpc,关闭net stop frpc
    set myPath=C:\app\frp\
    sc create frpc binPath= "%myPath%frpc.exe -c %myPath%frpc.toml" start= auto

    frpc.toml 客户端配置

    serverAddr = "121.0.0.0" #云服务器IP
    serverPort = 4433 #通信端口
    #管理端配置
    webServer.addr = "127.0.0.1"
    webServer.password = "111"
    webServer.port = 7400
    webServer.user = "admin"
    [[proxies]]
    name = "frp" #这个是配置自定义二级域名
    type = "http"
    localPort = 80
    customDomains = ["api.shanliwawa.top"]
    [[proxies]]
    name = "file_server" #这是文件服务器类似ftp
    type = "http"
    #remotePort = 9090
    subdomain = "file"
    [proxies.plugin]
    type = "static_file"
    localPath = "./web"
    #httpUser = "admin"
    #httpPassword = "4"
    [[proxies]]
    localPort = 80 #这个是配置一个需要账户密码的网站
    name = "ftp"
    type = "http"
    subdomain = "ftp"
    httpUser = "admin"
    httpPassword = "123"
    [[proxies]]
    localPort = 80 #这是网站服务
    name = "home"
    type = "http"
    subdomain = "home"
    [[proxies]]
    localPort = 80 #这是网站服务
    name = "h5"
    type = "http"
    subdomain = "h5"
    [[proxies]]
    localPort = 80 #这是网站服务
    name = "we7"
    type = "http"
    subdomain = "we7"
    [[proxies]]
    localPort = 8885 #这个是代理一个本地go开发的程序
    name = "weui"
    type = "http"
    subdomain = "weui"
  • 启动关闭vbs脚本
dim objShell 
set objShell=wscript.createObject("WScript.Shell") 
msgbox "启动frpc.exe进程成功"
iReturnCode=objShell.Run("C:\app\frp\frpc.exe -c C:\app\frp\frpc.toml",0,TRUE)
CreateObject("WScript.Shell").Run "taskkill /f /im frpc.exe", 0
msgbox "关闭frpc.exe进程成功"
作者:Yoby  创建时间:2020-07-26 22:52
 更新时间:2024-12-05 13:26
上一篇:
下一篇: