---
title: "websocket  通过nginx 转发配置"
author: "chzhxu"
date: "2018-09-30T15:12:16Z"
tags: []
categories: ["开源软件"]
slug: "websocket-nginx"
draft: false
lastmod: "2018-09-30T15:12:16Z"
id: 2431618
url: "https://gangling.iteye.com/blog/2431618"
---

1、location /{  } 中添加      
<span style="color:red">proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";</span>

2、http {} 中添加
<span style="color:red">     map $http_upgrade $connection_upgrade {
        default upgrade;
        ''      close;
    }</span>