码迷,mamicode.com
首页 > 其他好文 > 详细

nginx grpc 试用

时间:2018-05-09 16:50:32      阅读:325      评论:0      收藏:0      [点我收藏+]

标签:编译   gate   需要   configure   测试   www.   theme   user   http   

1. 编译

wget https://nginx.org/download/nginx-1.13.10.tar.gz
tar xvf nginx-1.13.10.tar.gz
cd nginx-1.13.10
./configure --with-http_ssl_module --with-http_v2_module

备注:需要安装pcre  openssl 
centos 操作为: yum install -y pcre-devel openssl-devel
2. 简单配置
   upstream  grpc9001 {
       server 127.0.0.1:9001 weight=20 max_fails=2 fail_timeout=30s;
    }
    upstream  grpc9000 {
       server 127.0.0.1:9000 weight=20 max_fails=2 fail_timeout=30s;
    }
    server {
        listen       80 http2;
        server_name  localhost;
        location / {
            root   html;
            index  index.html index.htm;
            grpc_pass grpc://grpc9001;
        }
        location /userserviceapp.UserServiceApp{
          grpc_pass grpc://grpc9001;
        }
        location /echoservice.EchoService{
          grpc_pass grpc://grpc9000;
        }    
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
    }
3. 几个问题
目前在使用  grpc-gateway中间件的时候存在内容content-type 的问题,具体的原因还需要进排查源码
对于grpc 的负载均衡以规则路由目前测试是没有问题的
4. 参考文档
https://www.nginx.com/blog/nginx-1-13-10-grpc/
https://mp.weixin.qq.com/s/kiMAMrPx_6lKYJlFwDK6rA
https://nginx.org/en/docs/http/ngx_http_grpc_module.html

nginx grpc 试用

标签:编译   gate   需要   configure   测试   www.   theme   user   http   

原文地址:https://www.cnblogs.com/rongfengliang/p/9014929.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!