Nginx Websocket配置

2019-10-22 16:59:35 浏览数 (1)

配置

代码语言:javascript复制
upstream imtest_xhkjedu {   
      server 123.123.123.123:8090;   
}  

  
server {  
      listen 80;  
      server_name imtest.abc.com;
      client_max_body_size  200m;  
location / {  
          proxy_pass http://imtest_xhkjedu/;  
          proxy_cookie_path / /;
          proxy_redirect  / /; 
          proxy_set_header Host $host;  
          proxy_set_header X-Real-IP $remote_addr;  
          proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;  
          proxy_http_version 1.1;
          proxy_set_header Upgrade $http_upgrade;
          proxy_set_header Connection "upgrade";
          client_max_body_size 200m;  
          client_body_buffer_size 128k;   
          proxy_connect_timeout 300s;
          proxy_send_timeout 300s;
          proxy_read_timeout 300s;   
          proxy_busy_buffers_size 64k;  
          proxy_temp_file_write_size 64k; 
          proxy_buffer_size 64k; 
          proxy_buffers 8 64k; 
          fastcgi_buffer_size 128k; 
          fastcgi_buffers 4 128k;
          send_timeout 60;   
  }
}

相比之前配置的HTTP代理 主要增加了以下配置

代码语言:javascript复制
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";

0 人点赞