jupyter notebook [W 12:01:41.199 NotebookApp] 400 GET /api/kernels/13f0d738-50a6-4e88-974c-367eb6e7ab00/channels?session_id

该问题是使用了nginx做代理,需要配置websocket转发,参考:
https://github.com/jupyter/notebook/issues/2664#issuecomment-346249652

 

upstream notebook {
        server localhost:8888;
}
server {
        listen 80;
        server_name xxx.xxxx.com;
        rewrite ^/(.*) https://xxx.xxxx.com/$1 permanent;
}
server{
        listen 443 ssl;
        index index.html index.htm index.php default.html default.htm default.php;
        server_name xxx.xxxx.com;
        root /home/wwwroot/xxx.xxxx.com;            
        ssl_certificate /etc/letsencrypt/live/xxx.xxxx.com/fullchain.pem;    
        ssl_certificate_key /etc/letsencrypt/live/xxx.xxxx.com/privkey.pem;   
        ssl_ciphers "EECDH+CHACHA20:EECDH+CHACHA20-draft:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5";
        ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
        ssl_prefer_server_ciphers on;
        ssl_session_cache shared:SSL:10m;

        location / {
                proxy_pass            http://notebook;
                proxy_set_header      Host $host;
        }

        location ~ /api/kernels/ {
                proxy_pass            http://notebook;
                proxy_set_header      Host $host;
                
                proxy_http_version    1.1;  # websocket support
                proxy_set_header      Upgrade "websocket";
                proxy_set_header      Connection "Upgrade";
                proxy_read_timeout    86400;
        }
        location ~ /terminals/ {
                proxy_pass            http://notebook;
                proxy_set_header      Host $host;
                
                proxy_http_version    1.1;  # websocket support
                proxy_set_header      Upgrade "websocket";
                proxy_set_header      Connection "Upgrade";
                proxy_read_timeout    86400;
        }
}

 

posted @ 2021-01-04 14:09  Virya  阅读(1579)  评论(0编辑  收藏  举报