jupyterhub搭建及配置

官方文檔

https://jupyterhub.readthedocs.io/en/latest/reference/technical-overview.html
找一臺(tái)linux服務(wù)器專門(mén)用于jupyterhub的搭建
用root賬號(hào)啟動(dòng)jupyterhub,jupyterhub的賬號(hào)系統(tǒng)直接與linux的賬號(hào)相關(guān)

初始配置

為了實(shí)現(xiàn)跨域跳轉(zhuǎn)登錄
jupyterhub_config.py配置文件內(nèi)容增加:

# 登錄后默認(rèn)看到的頁(yè)面
c.Spawner.default_url = '/tree/'
# 跳轉(zhuǎn)路由
c.JupyterHub.base_url = u'/jupyter/'
c.JupyterHub.bind_url = 'http://127.0.0.1:8000/jupyter/'
# 允許跨域,模擬登陸生成cookie的時(shí)候會(huì)用到
c.Spawner.args = ['--NotebookApp.allow_origin=*']
c.JupyterHub.tornado_settings = {
    'headers': {
        'Access-Control-Allow-Origin': '*',
    },
}

nginx代理配置

location /jupyter/ {
            # 跨域配置
            add_header Access-Control-Allow-Origin *;
            add_header Access-Control-Allow-Methods 'GET, POST, PUT, DELETE, OPTIONS';
            add_header Access-Control-Allow-Headers 'DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization';
            # jupyter地址
            proxy_pass http://127.0.0.1:8000;
            proxy_set_header Host $host;
            proxy_set_header X-Real-Scheme $scheme;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            # ws配置
            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "upgrade";
            proxy_read_timeout 120s;
            proxy_next_upstream error;
        }
jupyter中使用matplotlib

調(diào)中文字體:https://blog.csdn.net/qq_41770424/article/details/115708626

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容