nginx代理ws协议

2019-04-23  本文已影响0人  博楠同学
server {
    listen 443;
    root /home/sign/public/;
    server_name nh.nsfocus.com;
    location /wsapp/ {
        proxy_pass http://127.0.0.1:9501;
        proxy_redirect off;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";

        proxy_set_header Host $host:$server_port;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For   
        $proxy_add_x_forwarded_for;
        proxy_read_timeout 7200;
    }
    location /index/ {
        proxy_http_version 1.1;
        proxy_set_header Connection "keep-alive";
        proxy_set_header X-Real-IP $remote_addr;
        if (!-f $request_filename) {
            proxy_pass http://127.0.0.1:9501;
        }
    }
}
上一篇下一篇

猜你喜欢

热点阅读