• frp对http协议应用


    前言

    frp是一个开源的项目, 可用于内网穿透的高性能的反向代理应用,支持 tcp, udp 协议,为 http 和 https 应用协议提供了额外的能力,且尝试性支持了点对点穿透。

    github地址:https://github.com/fatedier/frp

    此处对http的应用做一个简单的记录,使用frp-v0.20.0版本进行介绍

    1.软件下载地址

    https://github.com/fatedier/frp/releases?after=v0.25.1

    2.服务端配置

    linux下配置,需要有一个公网的服务器,假如公网ip为 xxx.xxx.xxx.xxx

    下载软件:frp_0.20.0_linux_amd64.tar.gz

    解压:tar -zxvf frp_0.20.0_linux_amd64.tar.gz

    cd frp_0.20.0_linux_amd64

    启动服务端: 

    ./frps --bind_port=7000 --vhost_http_port=8080

    其中:

      --bind_port 为frp服务端口

      --vhost_http_port为http服务端口

    3.客户端配置

    3.1 windows下配置

    下载软件:frp_0.20.0_windows_amd64.zip

    解压:进入frp_0.20.0_windows_amd64目录

    编辑:

    frpc.ini 文件

    [common]
    server_addr = xxx.xxx.xxx.xxx
    server_port = 7000
    
    [web01]
    type = http
    local_port = 7758
    custom_domains = xxx.xxx.xxx.xxx

    说明:

      server_addr : frp的服务地址
      server_port : frp的服务端口

      web01:代理名称,随意命名
      type : 协议类型,此处为http
      local_port : 代理的本地端口
      custom_domains : 代理的地址,可以使用域名

    3.2 启动客户端

    打开cmd 命令窗口

    执行:frpc.exe -c frpc.ini

    3.3 访问方法

    使用custom_domains 指定的地址或者域名,端口为服务端的--vhost_http_port 指定的端口,此处为8080, 访问后就相当于访问到了本地的端口 7758
    此处为: xxx.xxx.xxx.xxx:8080
    代理方式相当于: xxx.xxx.xxx.xxx:8080 --> 127.0.0.1:7758

     4.建立多个反向代理

    这里的服务端和客户端是一对一的,所以需要重新建立服务端,指定不同的frp端口和http的端口

    4.1 服务端

    ./frps --bind_port=7001 --vhost_http_port=8081

    4.2 客户端

    从frpc.ini复制一个frpc1.ini,内容如下:

    [common]
    server_addr = xxx.xxx.xxx.xxx
    server_port = 7001
    
    [web02]
    type = http
    local_port = 7759
    custom_domains = xxx.xxx.xxx.xxx

    启动:frpc.exe -c frpc1.ini

    访问:xxx.xxx.xxx.xxx:8081

    代理方式相当于: xxx.xxx.xxx.xxx:8081 --> 127.0.0.1:7759

  • 相关阅读:
    O2O、B2B、C2C(通俗讲解)
    前端 $.parseJson()
    django反向解析传参
    从url(地址栏)获取参数:Jquery中getUrlParam()方法的使用
    Django:前后端分离后联调给前端传数据
    xpath 中 [<Element a at 3985984dj343>]
    sumafan:python爬虫多线程爬取数据小练习(附答案)
    window安装mysql(详细步骤)
    sqlserver从xlsx读取数据
    第一个kotlin程序
  • 原文地址:https://www.cnblogs.com/sancong/p/11388867.html
Copyright © 2020-2023  润新知