lwhttpd(全称lightweight httpd)是一个轻量级和高性能的web服务器. 支持CGI, FastCGI(计划中), proxy (计划中)和静态资源访问
本项目主页lwhttpd.org
TLS还未支持,也就是说还不能使用HTTPS
为了编译和运行本程序,你需要一下条件:
# Debug version $ cmake -S . -B ./build -DCMAKE_BUILD_TYPE=Debug # Release version(default) $ cmake -S . -B ./build $ cd build/ $ make -j8
已支持通过JSON配置
{ "server_name": "www.mydomain.com", "listen": [ { "address": "0.0.0.0", "port": 80 }, { "address": "::", "port": 80 } ], "web_root": "/var/htdocs", "work_thread": 0, "tls": { "cert_file": "/cert/tls.cert", "key_file": "/cert/tls.key" } }
# Make the 'htdocs' directory, and copy demo.cgi to the directory $ tree |-- htdocs | |-- demo.cgi | `-- index.html `-- lwhttpd $ sudo ./lwhttpd
# IPv4 $ curl -v http://127.0.0.1 $ curl -v http://127.0.0.1/demo.cgi?hello # IPv6 $ curl -v http://[::1] $ curl -v http://[::1]/demo.cgi?hello # auto $ curl -v http://localhost/demo.cgi?hello