您的位置:首页 > 运维架构 > Nginx

nginx支持websocket

2016-08-18 21:35 501 查看
1、修改配置文件nginx.conf

fastcgi_intercept_errors on;

map $http_upgrade $connection_upgrade {

        default upgrade;

        ''      close;

    }

    
upstream tomcat.apps {

        server 127.0.0.1:8080 weight=1;
}

include vhost/*.conf;

2、修改域名配置文件www_handansoft_com.conf

    location  / {

        proxy_pass http://tomcat.apps;
        proxy_redirect    off;

        proxy_set_header X-Real-IP $remote_addr;

        proxy_set_header Host $host;

        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

        proxy_http_version 1.1;

        proxy_set_header Upgrade $http_upgrade;

        proxy_set_header Connection "upgrade";

    }

红色部分为新增内容
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  nginx websocket 域名