Linux 下微型 http 服务器推荐?

2018 年 2 月 25 日
 creedowl

有时候需要一个微型的 http 服务器用作文件分享和 html 文件预览,之前一直用 python3 里面的 http.server,但这个不支持分段,大文件经常出错,请问有什么推荐?

10913 次点击
所在节点    Linux
52 条回复
azh7138m
2018 年 2 月 25 日
chrome 有个 app 叫做 Web Server,挺方便的
zjsxwc
2018 年 2 月 25 日
@pathbox

我 11 楼发了,代码很简单都是复制黏贴来的凑合看吧。。
pathbox
2018 年 2 月 25 日
@pathbox 看明白了,主要还是要前端播放器的支持
Cu635
2018 年 2 月 25 日
lighttpd、nginx 都可以。
jjianwen68
2018 年 2 月 25 日
nodejs 的话,可以看看:node-file-manager,anywhere
wspsxing
2018 年 2 月 25 日
https://github.com/biluohc/fht2p
无耻的抛链接,CLI 程序且支持简单的配置文件(toml)。
qiukong
2018 年 2 月 25 日
nginx 你用 debian 装也挺容易的,你看他是不是微型不光考虑大小,还要考虑性能。
caddy、lighttpd、nginx 里 nginx 是性能最好,占内存最小的。
icris
2018 年 2 月 25 日
之前用 go 写过一个十几行的代替 simple http server
```
package main

import (
"net/http"
"flag"
"fmt"
)

func main() {
path := flag.String("path", ".", "PATH to serve")
port := flag.String("port", "8000", "PORT to listen on")
flag.Parse()
fmt.Printf("listening on port %v...\n", *port)
panic( http.ListenAndServe(":" + *port, http.FileServer( http.Dir(*path))))
}
```
clino
2018 年 2 月 25 日
这个支持分块下载:
https://github.com/lerry/httpserver
Admstor
2018 年 2 月 25 日
lighttpd 足够轻了,文档什么也比较齐全
ARM 都能跑,应该可以了
hqs0417
2018 年 2 月 25 日
python -m SimpleHTTPserver
zn
2018 年 2 月 25 日
nginx,几乎零依赖,设置一点都不复杂,默认设置就够了。安装后把文件丢到 www 目录就完了。
cevincheung
2018 年 2 月 25 日
linux 自带 python。python 自带 simplehttpserver
snBDX1b0jJM4ogKd
2018 年 2 月 25 日
很久以前写的,https://github.com/ccssrryy/python_file_server/blob/master/main.py ,单文件,python2.7 的
des
2018 年 2 月 25 日
busybox httpd,小型设备一般都有这个。
临时用下挺好,不过没有 autoindex
autotesting
2018 年 2 月 25 日
我用 flask 写的内部共享展示产品文档的 html,通过和 git 联动支持产品文档的版本管理
charli
2018 年 2 月 25 日
文件分享可以看下`chfs`
```
http://iscute.me/chfs
```
Cat73
2018 年 2 月 25 日
@noe132 不是应该,是肯定了。。
flynaj
2018 年 2 月 25 日
按你的需求,还是 nginx 最合适
nwljy
2018 年 2 月 25 日
mina

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://study.congcong.us/t/432515

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX