首页   注册   登录
V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
NGINX
NGINX Trac
3rd Party Modules
Security Advisories
CHANGES
OpenResty
ngx_lua
Tengine
在线学习资源
NGINX 开发从入门到精通
NGINX Modules
ngx_echo
V2EX  ›  NGINX

nginx 转发 gprc 请求, UNAVAILABLE: HTTP status code 502

  •  
  •   Y4ssss · 290 天前 · 1006 次点击
    这是一个创建于 290 天前的主题,其中的信息可能已经有所发展或是发生改变。

    client 报错:
    UNAVAILABLE: HTTP status code 502

    nginx 日志:
    upstream sent too large http2 frame: 1377025 while reading response header from upstream, client: 127.0.0.1, server: hsltest.org1.peer0, request: "POST /protos.Events/Chat HTTP/2.0"

    nginx 需要配置那些信息啊

    nginx 配置如下

    http {
        include       mime.types;
    
        default_type  application/octet-stream;
        log_format main '$remote_addr - $upstream_addr - [$time_local] "$request" $status    	 $body_bytes_sent "$http_referer" "$http_user_agent" "-" "$host"';
        access_log    logs/http.access.log;
        sendfile      on;
        tcp_nopush    on;
        tcp_nodelay   on;
        
    	keepalive_timeout 240;
    	grpc_buffer_size 8m;
    	http2_max_field_size  2m;
    	http2_max_header_size 2m;
    	
    	proxy_buffer_size   2m;
    	proxy_buffers   4 2m;
    	proxy_busy_buffers_size   2m;
    	http2_recv_buffer_size 2m;
    	http2_chunk_size  2m;
    	
        server_names_hash_bucket_size 128;
       
        ssl on;
        ssl_certificate ssh/org1.peer0.tls.cer;
    	ssl_certificate_key ssh/org1.peer0.tls.key;
    	ssl_client_certificate ssh/org1.tlsca.cer;
    	ssl_verify_client on;
    
    	server {
        			listen 1051 ssl http2; 
    				server_name hsltest.org1.peer0;	
        			location / {   		
        				grpc_pass grpc://192.168.235.128:1051;
        			}
        		}
    						
    }
    
    2 回复  |  直到 2018-12-29 11:51:05 +08:00
        1
    solos   290 天前
    nginx 1.13.10 版本开始支持 grpc,老版本可以把 grpc 当做 tcp server 来配置
        2
    Y4ssss   290 天前
    @solos 版本是 1.14.2
    关于   ·   FAQ   ·   API   ·   我们的愿景   ·   广告投放   ·   感谢   ·   实用小工具   ·   4281 人在线   最高记录 5043   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.3 · 25ms · UTC 06:42 · PVG 14:42 · LAX 23:42 · JFK 02:42
    ♥ Do have faith in what you're doing.