hi-nginx 是一个基于 nginx 最新版开发的 c++ 应用服务器。它100%兼容 nginx。 使用 hi-nginx,开发者不必区分 nginx 的原有功能和 hi 的动态功能,两者是完全融合的。 安装方法: --add-module=ngx_http_hi_module 就行。跟编译 nginx 原版无异。 使用方法: directives : content: loc,if in loc example: hi,default: "" location /hello { hi hi/hello.so ; } directives : content: http,srv,loc,if in loc ,if in srv example: hi_need_cache,default: on hi_need_cache on|off; directives : content: http,srv,loc,if in loc ,if in srv example: hi_cache_size,default: 10 hi_cache_size 10; directives : content: http,srv,loc,if in loc ,if in srv example: hi_cache_expires,default: 300s hi_cache_expires 300s; directives : content: http,srv,loc,if in loc ,if in srv hi_need_headers,default: off example: hi_need_headers on|off; directives : content: http,srv,loc,if in loc ,if in srv hi_need_cookies,default: off example: hi_need_cookies on|off; hello,world: #include "servlet.hpp" namespace hi{ class hello : public servlet { public: void handler(request& req, response& res) { res.headers.find("Content-Type")->second = "text/plain;charset=UTF-8"; res.content = "hello,world"; res.status = 200; } }; } extern "C" hi::servlet* create() { return new hi::hello(); } extern "C" void destroy(hi::servlet* p) { delete p; } g++ -std=c++11 -I/home/centos7/nginx/include -shared -fPIC hello.cpp -o hello.so install hello.so /home/centos7/nginx/hi 或者使用hi-project脚本自动创建模板源文件和Makefile hi-project a b cd a make make install c++ 应用服务器 hi-nginx-1.0.0 发布下载地址