参考
- https://www.cloudpanel.io/blog/linux-web-servers/
- https://www.reddit.com/r/cpp/comments/cjj9t5/what_c_web_server_library_one_should_use_nowadays/
- https://www.libhunt.com/l/cpp/topic/http-server
- https://www.linuxlinks.com/free-open-source-cplusplus-web-frameworks/
web 框架列表
- lighttpd
- 官网 https://redmine.lighttpd.net/projects/lighttpd
- git https://github.com/lighttpd/lighttpd1.4
- 官网代码仓库 https://redmine.lighttpd.net/projects/lighttpd/repository
- OpenLiteSpeed
- 官网 https://openlitespeed.org/
- 使用源码编译教程 https://docs.openlitespeed.org/installation/source/
- github 仓库 https://github.com/litespeedtech/openlitespeed
- 二进制下载地址 wget https://openlitespeed.org/packages/openlitespeed-1.7.16.tgz
- 支持 python LSAPI、Ruby LSAPI、Node.js、CGI
- H2O
- 官网 https://h2o.examp1e.net/
- github https://github.com/h2o/h2o/
- 支持 FastCGI、mruby
- C语言开发
- Cady
- 官网 https://caddyserver.com/
- github https://github.com/caddyserver/caddy
- Go 开发
- 58.8k star
- Cherokee
- 官网 https://cherokee-project.com/
- 使用 apt 安装 https://cherokee-project.com/downloads.html
- github https://github.com/cherokee/webserver
- RESTinio
- github https://github.com/Stiffstream/restinio
- Cross-platform, efficient, customizable, and robust asynchronous HTTP(S)/WebSocket server C++ library with the right balance between performance and ease of use
- Crow
- github https://github.com/CrowCpp/Crow
- A Fast and Easy to use microframework for the web.
- uWebSockets
- github https://github.com/uNetworking/uWebSockets
- Simple, secure & standards compliant web server for the most demanding of applications
- mongoose
- github https://github.com/cesanta/mongoose
- Embedded Web Server
- Mongoose is a network library for C/C++. It provides event-driven non-blocking APIs for TCP, UDP, HTTP, WebSocket, MQTT, and other protocols.
- Boost Beast
- https://www.boost.org/doc/libs/1_66_0/libs/beast/doc/html/beast/introduction.html
- pistache
- github https://github.com/pistacheio/pistache
- A high-performance REST toolkit written in C++
- civetweb
- https://github.com/civetweb/civetweb
- Embedded C/C++ web server
- drogon
- https://github.com/drogonframework/drogon
- Drogon: A C++14/17/20 based HTTP web application framework running on Linux/macOS/Unix/Windows
- oatpp
- https://github.com/oatpp/oatpp
- Light and powerful C++ web framework for highly scalable and resource-efficient web application. It's zero-dependency and easy-portable.
- POCO
- https://github.com/pocoproject/poco
- The POCO C++ Libraries are powerful cross-platform C++ libraries for building network- and internet-based applications that run on desktop, server, mobile, IoT, and embedded systems.
- TreeFrog
- https://www.libhunt.com/l/cpp/topic/http-server
- TreeFrog Framework : High-speed C++ MVC Framework for Web Application
- Wt
- https://github.com/emweb/wt
- Web GUI library in modern C++
- CppCMS
- https://github.com/artyom-beilis/cppcms
- CppCMS is a Free High Performance Web Development Framework (not a CMS) aimed at Rapid Web Application Development
- ffead-cpp
- https://github.com/sumeetchhetri/ffead-cpp
- Framework for Enterprise Application Development in c++, HTTP1/HTTP2/HTTP3 compliant, Supports multiple server backends
几个 http 库
- https://www.jmarshall.com/easy/http/
- A Practical Guide to Writing Clients and Servers
- https://github.com/etr/libhttpserver
- C++ library for creating an embedded Rest HTTP server (and more)
- https://gitlab.com/eidheim/Simple-Web-Server
- A very simple, fast, multithreaded, platform independent HTTP and HTTPS server and client library implemented using C++11 and Boost.Asio. Created to be an easy way to make REST resources available from C++ applications.
- https://github.com/apache/brpc/tree/master
- brpc is an Industrial-grade RPC framework using C++ Language, which is often used in high performance system such as Search, Storage, Machine learning, Advertisement, Recommendation etc. "brpc" means "better RPC".
- https://github.com/h2o/picohttpparser
- tiny HTTP parser written in C (used in HTTP::Parser::XS et al.)
- 只负责 http 协议解析
例子
例1. cpp-httplib
1.1 clone 代码
git clone git@github.com:yhirose/cpp-httplib.git
2. 安装依赖
apt install libssl-dev libbrotli-dev
3. 编译
cd cpp-httplib/example && make
如果访问到了不存在的 path,结果就会返回的很慢