nginx 启用websocket支持

  • nginx.conf修改配置
http {
	# http段增加
	map $http_upgrade $connection_upgrade {
        default upgrade;
        '' close;
    }
    ...
    server {
    	location ... {
    		# location段增加
            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection $connection_upgrade; 		
    	}
    }
}

posted on 2020-07-10 09:53  路过君  阅读(139)  评论(0编辑  收藏  举报

导航