ubuntu20.04安装测试uhttpd
uhttpd是openwrt上运行一个高效小型Http服务,支持cgi, lua等特性。可以直接通过snap方式安装,如果是16.04,18.04或者20.04,snap已经默认安装了;如果是其它版本,需要先安装snap: sudo apt install snapd
然后安装:
sudo snap install uhttpd
默认80端口,为避免与apache2冲突,可以修改成其它端口,如8086:
sudo snap set uhttpd listening-port=8086
默认根目录在/var/snap/uhttpd/common,通过set方法修改好像不成功:sudo snap set uhttpd document-root-dir=/media/USB
然后通过snap命令启动即可:
$ snap run uhttpd
2021/01/03 17:24:14 Serving "/var/snap/uhttpd/common"
2021/01/03 17:24:14 Listening on ":8086"
可以在命令后面加上&号(snap run uhttpd &)以后台方式执行。
当然了,上面使用的是默认选项,也可以直接以参数指定方式修改这些默认选项,如端口、根目录等,如:uhttpd -dir=/home/user/www -addr="127.0.0.1:8080"
更多用法:
Usage of uhttpd:
-addr=":80": The ADDRESS:PORT to listen on
-dir="": The directory to serve up
-log=false: Enable/disable logging
-log-path="": Log to file (leave blank for STDOUT)
-log-prefix="uhttpd": Set the logging prefix
-addr="..."
lets you set the IPv4 address and port uhttp listens on.
-dir="..."
tells uhttpd which directory to serve files out of.
-log
tells uhttpd to log requests for files.
-log-path="..."
is an optional flag, and lets you specify the name of a file to write your request logs to. If you do not specify a log file, the request logs are written to standard output (STDOUT).
-log-prefix="..."
is another optional flag, that lets you specify the logging prefix; by default, the logging prefix is "uhttpd".
More detail: https://github.com/nesv/uhttpd
最新文章
- Apworks框架实战(五):EasyMemo的领域模型设计
- Wind7外接显示器选择拓展模式后,鼠标只能往右移动才能切换到外接显示器上,不能修改切换方向
- 了解 Office 365
- editplus 替换换行 excel 表格 拼装sql语句技巧
- OC3_协议关键字
- ASP.NET中配置应用程序
- I2C的主机从机模拟
- jQuery获取select option
- ChildNodes详解及其兼容性处理方式
- 《github一天一道算法题》:插入排序
- Spring Boot 系列(二)单元测试&;网络请求
- 获取对固定列不重复的新DataTable
- Codeforces Round #407 (Div. 1)
- windows 分页缓冲池 非分页缓冲池
- Spark集群部署(standLone)模式
- Linux 系统的用户和组
- sql server 性能调优之 资源等待 LCk
- mysql sql文件批量处理
- 微信小程序 发现之旅(三)—— 组件之间的参数传递
- php实现异步请求