章工运维 章工运维
首页
  • linux
  • windows
  • 中间件
  • 监控
  • 网络
  • 存储
  • 安全
  • 防火墙
  • 数据库
  • 系统
  • docker
  • 运维工具
  • other
  • elk
  • K8S
  • ansible
  • Jenkins
  • GitLabCI_CD
  • 随笔
  • 面试
  • 工具
  • 收藏夹
  • Shell
  • python
  • golang
友链
  • 索引

    • 分类
    • 标签
    • 归档
    • 首页 (opens new window)
    • 关于我 (opens new window)
    • 图床 (opens new window)
    • 评论 (opens new window)
    • 导航栏 (opens new window)
周刊
GitHub (opens new window)

章工运维

业精于勤,荒于嬉
首页
  • linux
  • windows
  • 中间件
  • 监控
  • 网络
  • 存储
  • 安全
  • 防火墙
  • 数据库
  • 系统
  • docker
  • 运维工具
  • other
  • elk
  • K8S
  • ansible
  • Jenkins
  • GitLabCI_CD
  • 随笔
  • 面试
  • 工具
  • 收藏夹
  • Shell
  • python
  • golang
友链
  • 索引

    • 分类
    • 标签
    • 归档
    • 首页 (opens new window)
    • 关于我 (opens new window)
    • 图床 (opens new window)
    • 评论 (opens new window)
    • 导航栏 (opens new window)
周刊
GitHub (opens new window)
  • linux

  • windows

  • 中间件

    • nginx

      • nginx配置教程
      • nginx常用配置
      • keepalived的原理和web服务高可用实践
      • 在CentOS 7上编译安装Nginx
      • nginx配置下载站点
      • nginx配置代理ftp
      • nginx配置php程序负载均衡
      • nginx反代grpc
        • nginx需要支持http2
        • 明文传输
        • 单向认证
        • 双向认证
    • kafka

    • rabbitmq

    • centos7.9部署keepalived
    • 应用性能监控-skywalking
  • 网络

  • 安全

  • 存储

  • 防火墙

  • 数据库

  • 系统

  • docker

  • other

  • 监控

  • 运维
  • 中间件
  • nginx
章工运维
2024-06-05
目录

nginx反代grpc

# nginx需要支持http2

# nginx-1.24.0 版本
./configure --with-http_v2_module --with-openssl=/openssl-3.0.2
make
make install
1
2
3
4

# 明文传输

upstream gprc19090{
    server 10.1.1.1:19090;
}
server {
    listen 19090 http2;

    location / {
        grpc_pass grpc://gprc19090;
    }
}
1
2
3
4
5
6
7
8
9
10

# 单向认证

upstream grpcssl29090{
    server 10.1.1.1:29090;
}

server {
        listen 29090 ssl http2;

        ssl_certificate /tmp/server.cert.pem;
        ssl_certificate_key /tmp/server.key.pem;

        location / {
            grpc_pass grpc://grpcssl29090;
        }
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14

# 双向认证

upstream grpcdssl39090{
    server 10.1.1.1:39090;
}

server {
        listen 39090 ssl http2;

        ssl_certificate /tmp/server.cert.pem;
        ssl_certificate_key /tmp/server.key.pem;
        ssl_client_certificate /tmp/cacert.pem;
        #ssl_crl /tmp/crl.pem;                    # 吊销证书列表
        ssl_verify_client on; 
        ssl_session_timeout 5m;
        ssl_protocols TLSv1.2; 
        ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE; 
        ssl_prefer_server_ciphers on;        

        location / {
            grpc_pass grpc://grpcdssl39090;
        }
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
微信 支付宝
上次更新: 2024/06/05, 16:23:38

← nginx配置php程序负载均衡 kafka介绍和常见操作→

最近更新
01
shell脚本模块集合
05-13
02
生活小技巧(认知版)
04-29
03
生活小技巧(防骗版)
04-29
更多文章>
Theme by Vdoing | Copyright © 2019-2025 | 点击查看十年之约 | 鄂ICP备2024072800号
  • 跟随系统
  • 浅色模式
  • 深色模式
  • 阅读模式