对外提供简单的文件访问服务

通过配置 static_file 客户端插件,您可以将本地文件暴露在公网上,以供其他人访问。

通过使用 static_file 插件,您可以轻松地提供一个基于 HTTP 的文件访问服务,让其他人可以访问您指定的文件。

步骤

  1. 配置 frps.toml

    在 frps.toml 文件中添加以下内容:

    bindPort = 7000
        
  2. 配置 frpc.toml

    在 frpc.toml 文件中添加以下内容,确保设置合适的文件路径、用户名和密码:

    serverAddr = "x.x.x.x"
        serverPort = 7000
        
        [[proxies]]
        name = "test_static_file"
        type = "tcp"
        remotePort = 6000
        [proxies.plugin]
        type = "static_file"
        # 本地文件目录,对外提供访问
        localPath = "/tmp/file"
        # URL 中的前缀,将被去除,保留的内容即为要访问的文件路径
        stripPrefix = "static"
        httpUser = "abc"
        httpPassword = "abc"
        

    请根据实际情况修改 localPathstripPrefixhttpUserhttpPassword

  3. 启动 frps 和 frpc

  4. 通过浏览器访问文件

    使用浏览器访问 http://x.x.x.x:6000/static/,以查看位于 /tmp/file 目录下的文件。系统会要求输入您设置的用户名和密码。

最后修改 November 15, 2023: fix 404 (#71) (626ce4d)

Provide simple file access service to the public

通过Configuration static_file ClientPlug-in, you can expose local files on the public network for others to access.

Through Use static_file Plug-in, you can easily provide a method based on. HTTP's file access service allows others to access the files you specify.

Steps

  1. Configuration frps.toml

    Add the following to the frps.toml file:

    bindPort = 7000
      
  2. Configuration frpc.toml

    In frpc.toml. Add the following to the file to ensure that the appropriate file path, user name, and password are set:

    serverAddr = "x.x.x.x"
      serverPort = 7000
      
      [[proxies]]
      name = "test_static_file"
      type = "tcp"
      remotePort = 6000
      [proxies.plugin]
      type = "static_file"
      # 本地文件目录,对外提供访问
      localPath = "/tmp/file"
      # URL 中的前缀,将被去除,保留的内容即为要访问的文件路径
      stripPrefix = "static"
      httpUser = "abc"
      httpPassword = "abc"
      

    Please modify it according to the actual situation localPathstripPrefixhttpUser And httpPassword

  3. Start frps and frpc

  4. Access files through a browser

    Use browser access http://x.x.x.x:6000/static/ to view the location /tmp/file Files in the directory. The system will require you to enter the username and password you have set.

Last modified November 15, 2023: fix 404 (#71) (626ce4d)