zoukankan      html  css  js  c++  java
  • 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

  • 相关阅读:
    CodeForces Round #288 Div.2
    POJ 3660 Cow Contest【传递闭包】
    ZOJ 3321 Circle【并查集】
    CF 286(div 2) B Mr. Kitayuta's Colorful Graph【传递闭包】
    CF 287(div 2) B Amr and Pins
    HDU 2122 Ice_cream’s world III【最小生成树】
    HDU 1233 还是畅通工程【最小生成树】
    奶牛接力 矩阵乘法
    家谱 并差集
    昂贵的聘礼 最短路 dijkstra
  • 原文地址:https://www.cnblogs.com/wzc0066/p/14226149.html
Copyright © 2011-2022 走看看