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";
    }
}
原文地址:https://www.cnblogs.com/YrRoom/p/11107430.html