Nginx支持WebSocket服务

server{
        listen 80;
        access_log  logs/12345.jieyun.top.log  main;
        server_name 12345.jieyun.top; #绑定域名
        index index.php; #默认文件
        location / {
            proxy_pass  http://localhost:7001;
            index  index.php;
            proxy_set_header Host $host;
            #proxy_set_header X-Real-IP $remote_addr;
            #proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        }

    location /MsgHub
    {
        proxy_pass http://localhost:7001;
        # WebScoket Support
            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;    
        proxy_set_header Connection "upgrade";
    }
}

 

posted @ 2019-06-29 18:21  接云网络  阅读(333)  评论(0编辑  收藏  举报