1. XenForo 1.5.14 中文版——支持中文搜索!现已发布!查看详情
  2. Xenforo 爱好者讨论群:215909318 XenForo专区

新闻 c++ 应用服务器 hi-nginx-1.0.0 发布 下载

本帖由 漂亮的石头2017-05-15 发布。版面名称:软件资讯

  1. 漂亮的石头

    漂亮的石头 版主 管理成员

    注册:
    2012-02-10
    帖子:
    487,979
    赞:
    47
    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 发布下载地址
     
正在加载...