configure websocket forward in nginx

server
{
listen 80;
server_name mydomain.com.cn;

*#all incoming packets occured in 80*
**location /**{
    proxy_redirect off;
    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_pass http://122.XXX.XXX.XXX:8090;
    *#match ws content and construct http shakehand packet*
    **location /chatRoom/** {
        proxy_pass http://122.XXX.XXX.XXX:8090;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
    }
}
access_log logs/galaxy.access.log;

}

阅读更多
文章标签: nginx
个人分类: 技术
想对作者说点什么? 我来说一句

Nginx + Websocket 实现推送

2017年08月03日 67KB 下载

没有更多推荐了,返回首页

不良信息举报

configure websocket forward in nginx

最多只允许输入30个字

加入CSDN,享受更精准的内容推荐,与500万程序员共同成长!
关闭
关闭