nginx配置websocket反向代理(KubeSphere配置域名问题)

示例配置

注意点:

  1. map里面的配置
  2. Connection 和 Upgrade
map $http_upgrade $connection_upgrade {
  default upgrade;
  '' close;
}
upstream kubesphere {
  server 192.168.0.88:30880;
  server 192.168.0.89:30880;
  server 192.168.0.90:30880;
  keepalive 300;
}


server {
    listen 80;
    server_name xxx.xxx.com;
    access_log /var/log/nginx/kubesphere_access.log;
    error_log /var/log/nginx/kubesphere_error.log;


    location / {
        proxy_pass http://kubesphere/;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection $connection_upgrade;
        proxy_set_header Host $host;
    }


    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   /usr/share/nginx/html;
    }

}

你可能感兴趣的:(nginx配置websocket反向代理(KubeSphere配置域名问题))