nginx支持websocket

来源:互联网 发布:sublime text 3运行js 编辑:程序博客网 时间:2024/06/05 09:14

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";

    }


红色部分为新增内容

0 0
原创粉丝点击