在 Linux 中用 C++ 编写的 Web Server/Web 服务
Web Server/Web service written in C++ in Linux
要求是拥有 Linux 机器,无需额外安装 Java、apache tomcat/jboss,这将能够用作 Web 服务器并接受 Web 服务请求(我将不得不用 C++ 编写一些将在该 Web 服务器下服务的 Web 服务。
所以,问题是是否有一些 C++ 库提供了这样的 Web 服务器模拟,因为从外部它应该以相同的方式运行 - 获取 http 请求并重定向到适当的 Web 服务。
问错了地方(softwarerecs is probably more appropriate), but you probably want to use some HTTP server library like libonion, or libmongoose, or even Wt 等。所有这些库都可以为您的应用程序添加一些 Web 服务功能(例如,用几十行 C++ 编写 Web 服务器应用程序代码)。
顺便说一句,如果使用 Ocaml 编码,请考虑使用 Ocsigen 或 Ocamlnet。
如果您还需要 HTTP 客户端库,请考虑 libcurl
您可能也对 fastcgi. Several existing web servers are able to handle some web requests to a FastCGI 申请感兴趣。
如果要过滤或转换 HTTP 请求,请考虑 ICAP
您需要熟悉网络技术的基础知识(HTTP、HTML5、Javascript、AJAX、Websockets、Jquery、...)请参阅例如w3schools(不完美)。
您可以使用 node.js 制作一个非常简单的 http 服务器,从这里复制答案:
Using node.js as a simple web server
最简单的 Node.js 服务器就是:
$ npm install http-server -g
现在您可以通过以下命令 运行 服务器:
$ cd MyApp
$ http-server
为了补充其他答案还有:
Cutelyst a C++11 built with Qt, with one of the best positions on TechEmpower Benchmarks.
尽管它需要 Qt 5.6+,但完整的 CMS (CMlyst) 使用大约 6MB 的内存,同时在单核上每秒处理大约 3000 个请求。
要求是拥有 Linux 机器,无需额外安装 Java、apache tomcat/jboss,这将能够用作 Web 服务器并接受 Web 服务请求(我将不得不用 C++ 编写一些将在该 Web 服务器下服务的 Web 服务。
所以,问题是是否有一些 C++ 库提供了这样的 Web 服务器模拟,因为从外部它应该以相同的方式运行 - 获取 http 请求并重定向到适当的 Web 服务。
问错了地方(softwarerecs is probably more appropriate), but you probably want to use some HTTP server library like libonion, or libmongoose, or even Wt 等。所有这些库都可以为您的应用程序添加一些 Web 服务功能(例如,用几十行 C++ 编写 Web 服务器应用程序代码)。
顺便说一句,如果使用 Ocaml 编码,请考虑使用 Ocsigen 或 Ocamlnet。
如果您还需要 HTTP 客户端库,请考虑 libcurl
您可能也对 fastcgi. Several existing web servers are able to handle some web requests to a FastCGI 申请感兴趣。
如果要过滤或转换 HTTP 请求,请考虑 ICAP
您需要熟悉网络技术的基础知识(HTTP、HTML5、Javascript、AJAX、Websockets、Jquery、...)请参阅例如w3schools(不完美)。
您可以使用 node.js 制作一个非常简单的 http 服务器,从这里复制答案:
Using node.js as a simple web server
最简单的 Node.js 服务器就是:
$ npm install http-server -g
现在您可以通过以下命令 运行 服务器:
$ cd MyApp
$ http-server
为了补充其他答案还有:
Cutelyst a C++11 built with Qt, with one of the best positions on TechEmpower Benchmarks.
尽管它需要 Qt 5.6+,但完整的 CMS (CMlyst) 使用大约 6MB 的内存,同时在单核上每秒处理大约 3000 个请求。