通过 static_file 插件可以对外提供一个简单的基于 HTTP 的文件访问服务。类似于http的文件索引!

服务端frps.ini配置
[common]
bind_addr = 0.0.0.0
bind_port = 7000
privilege_token = 12345678

客户端frpc.ini配置
[common]
server_addr = 服务端IP
server_port = 7000
privilege_token = 12345678

[static_file]
type = tcp
local_ip = 127.0.0.1
remote_port = 6000
plugin = static_file
plugin_local_path = /tmp/file
plugin_strip_prefix = static
plugin_http_user = admin
plugin_http_passwd = admin

static_file 插件参数详解
plugin = static_file为开启插件static_file模式
plugin_local_path文件目录的绝对路径
plugin_strip_prefix访问网址后缀路径
通过浏览器访问 http://x.x.x.x:6000/static/
来查看位于 /tmp/file 目录下的文件,如不需要,可以不添加此参数。
plugin_http_user为http访问验证的用户名,可自定义,可添加此参数或不添加。
plugin_http_passwd为http访问验证的密码,可自定义,可添加此参数或不添加。

注意:客户端访问时需要加上端口号,每个客户端使用的端口号均不能相同

实际配置

frps服务端配置(linux系统)
[root@hn frps]# cat frps.ini
[common]
bind_port = 7000
vhost_http_port = 8080
#vhost_https_port = 8080
dashboard_port = 7500
# dashboard 用户名密码,默认都为 admin
dashboard_user = admin
dashboard_pwd = admin
privilege_token = 12345678
privilege_allow_ports = 2000-3000
max_pool_count = 10
subdomain_host = 1.2.com
log_file = ./frps.log
log_level = info
log_max_days = 3

windows作为frpc客户端使用 =>访问地址:http://x.x.x.x:2900/static
[common]
server_addr = x.x.x.x  #frps服务端IP
server_port = 7000
privilege_token = 12345678 #校验
pool_count = 2
log_file = ./frpc.log
log_level = info
log_max_days = 3

[static_file]
type = tcp
local_ip = 127.0.0.1
remote_port = 2900  #frps服务端端口放行
plugin = static_file
plugin_local_path = D:/Py/10  #本机目录,注意写法
plugin_strip_prefix = static
plugin_http_user = admin  #账号
plugin_http_passwd = admin #密码

linux作为frpc客户端使用  =>访问地址:http://x.x.x.x:2002/static
[common]
server_addr = x.x.x.x
server_port = 7000
privilege_token = 12345678
pool_port = 2
log_file = ./frpc.log
log_level = info
log_max_days = 3

[plugin_static_file]
type = tcp
remote_port = 2002
plugin = static_file
plugin_local_path = /tmp/file
plugin_strip_prefix = static
plugin_http_user = abc
plugin_http_passwd = abc

九、frp对外提供简单的文件访问服务的更多相关文章

  1. zookeeper集群,每个服务器上的数据是相同的,每一个服务器均可以对外提供读和写的服务,这点和redis是相同的,即对客户端来讲每个服务器都是平等的。

    zookeeper集群,每个服务器上的数据是相同的,每一个服务器均可以对外提供读和写的服务,这点和redis是相同的,即对客户端来讲每个服务器都是平等的.

  2. 基于FeignClient提供简单的用户查询服务

    前言: 由于系统升级,之前的员工数据库(mongo库)被弃用,改为用python维护的mysql库,其他系统访问通过http请求,表结构对外不可见,其他系统之前对员工mongo库的依赖要解除.每套系统 ...

  3. 开发FTP服务接口,对外提供接口服务

    注意:本文只适合小文本文件的上传下载,因为post请求是有大小限制的.默认大小是2m,虽然具体数值可以调节,但不适合做大文件的传输 最近公司有这么个需求:以后所有的项目开发中需要使用ftp服务器的地方 ...

  4. Frp内网穿透搭建,家庭主机对外提供接口,支持ssh访问

    Frp内网穿透搭建,家庭主机对外提供接口,支持ssh访问 1.使用场景: 需求1.家中服务器 ubuntu 主机,跑接口服务,需要对外暴漏, 需求2.同时需要在外网ssh远程 ​ 关键词: frp内网 ...

  5. 使用jsp/servlet简单实现文件上传与下载

    使用JSP/Servlet简单实现文件上传与下载    通过学习黑马jsp教学视频,我学会了使用jsp与servlet简单地实现web的文件的上传与下载,首先感谢黑马.好了,下面来简单了解如何通过使用 ...

  6. Android学习笔记(十九)——内容提供器

    //此系列博文是<第一行Android代码>的学习笔记,如有错漏,欢迎指正! 内容提供器(Content Provider)主要用于在不同的应用程序之间实现数据共享的功能,它提供了一套完整 ...

  7. 使用WCF对外提供接口

    本篇将通过WCF以webservices的方式对外提供接口.同时使用NUnit对webservices中的方法进行单元测试. 开发契约 contract Contract项目为类库项目,该项目下会包含 ...

  8. grpc-gateway:grpc对外提供http服务的解决方案

    我所在公司的项目是采用基于Restful的微服务架构,随着微服务之间的沟通越来越频繁,就希望可以做成用rpc来做内部的通讯,对外依然用Restful.于是就想到了google的grpc. 使用grpc ...

  9. atitit.网络文件访问协议.unc smb nfs ftp http的区别

    atitit.网络文件访问协议.unc smb nfs ftp http的区别 1. 网络文件访问协议1 2. NETBios协议  2 3. SMB(Server Message Block)2 3 ...

随机推荐

  1. fun(int **p)的使用

    #include <iostream>using namespace std;void fun(int **p){ cout << p[0][0] << endl; ...

  2. 关于NumPy的坑

         初次接触NumPy的时候,感叹这个功能的强大,实现了Python对矩阵的运算,但在写一个项目的时候,发现了一个巨坑无比的情况     分隔符=================     对于被 ...

  3. JavaScript(正则表达式一)

    -------------------- 创建正则表达式: 验证匹配的两个方法 //正则表达式测试 /* var p=new RegExp("Box","i") ...

  4. 基于redis的分布式锁实现方案--redisson

    实例代码地址,请前往:https://gitee.com/GuoqingLee/distributed-seckill redis官方文档地址,请前往:http://www.redis.cn/topi ...

  5. Arduino基本函数介绍

    转载自http://cnlearn.linksprite.com/?p=5248#.VwZrzvl95hE 数字 I/O (1)pinMode(pin, mode) 数字IO 口输入输出模式定义函数, ...

  6. 工具-vscode使用

    1.智能感知 vscode使用DefinitelyTyped进行自动完成所以需要先安装tsd,命令: npm install -g tsd 安装完成后,首先安装node基本语法支持 tsd query ...

  7. HDU 2138

    这题用MILLER测试应该是不可避免的. #include <iostream> #include <cstdio> #include <stdlib.h> #in ...

  8. hrift does not support polymorphic data types

    hrift does not support polymorphic data types Exception in thread "main" com.facebook.swif ...

  9. http格式(graph)

    http请求格式 http请求头 字段 http响应 http响应头字段

  10. [POJ 2279] Mr. Young's Picture Permutations

    [题目链接] http://poj.org/problem?id=2279 [算法] 杨氏矩阵与勾长公式 [代码] #include <algorithm> #include <bi ...