Linux
linux下的yum命令报错
【实用】精简Commands(更新)
SSH登录Linux系统提示信息"There were xxxx failed login attempts since the last successful login."
生信软件安装前配置
NewMechine-Linux
捡了一台垃圾-蜗牛星际单网口
群晖系统升级攻略
群晖的一些工具
群晖中玩脚本【实践可行才记录】
群晖套件迁移(从存储2到存储4)
移动吉比特光猫 SK-D746 获取动态超级管理员帐号与密码
linux使用crontab命令指定时间段内随机执行任务
【实用】局域网数据共享之王-gohttpserver
本文档使用 MrDoc 发布
-
+
up
down
首页
【实用】局域网数据共享之王-gohttpserver
良心项目,通过http协议就能访问自己搭建的文件服务器。 > w为啥要访问自己搭建的文件服务器??? 其实,只是为了给其他部门的所有人员可以访问一个共享文件夹而已!之前在一个同事电脑上,大量拷贝导致她电脑很卡,所以干脆放到服务器上,同时做好:1、新数据来了就备份,便于新数据自动化;2、下载数据用于cma分析;3、写好的报告上传到对应位置;4、部分文件在线预览(pdf); [gohttpserver](https://github.com/codeskyblue/gohttpserver) **真的太好用了!真的太好用了!真的太好用了!**  ## 安装开始 ### 安装 直接点击上面github页面去安装,可以直接go安装,也可以直接下载对应的二进制编译好的执行文件。 ``` # go 安装 go install github.com/codeskyblue/gohttpserver@latest ``` ### 开始 ``` gohttpserver gohttpserver -r ./ --port 8000 --upload ``` ## 参数和使用方法 给一张图来介绍功能和用法吧:  > d1、上图漏了标题的修改了,使用`--title`参数。 2、`--delete`参数说明错了,他是打开删除功能且打开创建文件夹功能。 所有参数解释如下: ``` usage: gohttpserver [<flags>] Flags: -h, --help Show context-sensitive help (also try --help-long and --help-man). --version Show application version. --conf=CONF config file path, yaml format -r, --root=ROOT root directory, default ./ --prefix=PREFIX url prefix, eg /foo --port=PORT listen port, default 8000 -a, --addr=ADDR listen address, eg 127.0.0.1:8000 --cert=CERT tls cert.pem path --key=KEY tls key.pem path --auth-type=AUTH-TYPE Auth type <http|openid> --auth-http=AUTH-HTTP HTTP basic auth (ex: user:pass) --auth-openid=AUTH-OPENID OpenID auth identity url --theme=THEME web theme, one of <black|green> --upload enable upload support --delete enable delete support --xheaders used when behide nginx --cors enable cross-site HTTP request --debug enable debug mode -p, --plistproxy=PLISTPROXY plist proxy when server is not https --title=TITLE server title --google-tracker-id=GOOGLE-TRACKER-ID set to empty to disable it ``` ## 更多用法 go语言编写的文件服务器,除了**支持页面上传下载文件**之外,还**支持通过`curl`的命令方式上传和下载文件**,**支持用户授权认证**。 ### 命令curl上传下载 ``` #上传文件 curl -F file=@foo.txt localhost:8000/somedir #通过token上传文件 $ curl -F file=@foo.txt -F token=12312jlkjafs localhost:8000/somedir ``` ### 用户授权认证 ``` # Enable basic http authentication gohttpserver --auth-type http --auth-http username:password # Use openid auth gohttpserver --auth-type openid --auth-openid https://login.example-hostname.com/openid/ # Use oauth2-proxy with gohttpserver --auth-type oauth2-proxy ``` 就用个最简单的http认证吧~ 其他两个不会用
laihui126
2024年5月8日 16:18
分享文档
收藏文档
上一篇
下一篇
微信扫一扫
复制链接
手机扫一扫进行分享
复制链接
关于 MrDoc
觅道文档MrDoc
是
州的先生
开发并开源的在线文档系统,其适合作为个人和小型团队的云笔记、文档和知识库管理工具。
如果觅道文档给你或你的团队带来了帮助,欢迎对作者进行一些打赏捐助,这将有力支持作者持续投入精力更新和维护觅道文档,感谢你的捐助!
>>>捐助鸣谢列表
微信
支付宝
QQ
PayPal
下载Markdown文件
分享
链接
类型
密码
更新密码